aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/ui/uiDependency.js
blob: 4a5775c57f8d1d11de9a7ba4d86628bed3d2ac02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(function() {
	var loadedBeforeVaadin = (window.vaadin === undefined);
	
	window.reportUiDependencyStatus = function() {
		var styleIndex = 1000;
		var themeIndex = -1;
		
		var stylesheets = document.querySelectorAll("link[rel=stylesheet]");
		for(var i = 0; i < stylesheets.length; i++) {
			var stylesheet = stylesheets[i];
			var href = stylesheet.getAttribute("href"); 
			if (href.indexOf("uiDependency.css") > -1) {
				styleIndex = i;
			} else if (href.indexOf("styles.css" > -1)) {
				themeIndex = i;
			}
		}
		
		var status = "Script loaded before vaadinBootstrap.js: " + loadedBeforeVaadin;
		status += "<br />Style tag before vaadin theme: " + (styleIndex < themeIndex);
		
		document.getElementById("statusBox").innerHTML = status;
	}
})();