diff options
author | Artur <artur@vaadin.com> | 2017-01-24 15:41:15 +0200 |
---|---|---|
committer | Aleksi Hietanen <aleksi@vaadin.com> | 2017-01-24 15:41:15 +0200 |
commit | c916782da19362dc210402bbe922873d6386b05d (patch) | |
tree | 5e184d80e68f5b65e13d51c5ccf36e84d2b3125a /uitest/src | |
parent | a0b80c1d9b22aed986e885d8a32cf1446533d6da (diff) | |
download | vaadin-framework-c916782da19362dc210402bbe922873d6386b05d.tar.gz vaadin-framework-c916782da19362dc210402bbe922873d6386b05d.zip |
Support using multiple @JavaScript and @StyleSheet annotations on a class (#8293)
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloading.java | 3 | ||||
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/ui/UiDependenciesInHtml.java | 3 | ||||
-rw-r--r-- | uitest/src/main/resources/com/vaadin/tests/components/ui/uiDependency.js | 32 | ||||
-rw-r--r-- | uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency1.css (renamed from uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency.css) | 0 | ||||
-rw-r--r-- | uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency2.css | 0 | ||||
-rw-r--r-- | uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency3.css | 0 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java | 2 |
7 files changed, 26 insertions, 14 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloading.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloading.java index 1e69c410e3..3377fc4bfa 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloading.java +++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloading.java @@ -28,7 +28,8 @@ public class JavaScriptPreloading extends AbstractReindeerTestUI { public String xhtml; } - @JavaScript({ "js_label.js", "wholly_different.js" }) + @JavaScript("js_label.js") + @JavaScript("wholly_different.js") public class JsLabel extends AbstractJavaScriptComponent { public JsLabel(final String xhtml) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/UiDependenciesInHtml.java b/uitest/src/main/java/com/vaadin/tests/components/ui/UiDependenciesInHtml.java index 53eff1b733..fd76f2f957 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/UiDependenciesInHtml.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/UiDependenciesInHtml.java @@ -23,7 +23,8 @@ import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Label; @JavaScript("uiDependency.js") -@StyleSheet("theme://uiDependency.css") +@StyleSheet({ "theme://uiDependency1.css", "theme://uiDependency2.css" }) +@StyleSheet("theme://uiDependency3.css") @Theme("tests-valo") public class UiDependenciesInHtml extends AbstractReindeerTestUI { diff --git a/uitest/src/main/resources/com/vaadin/tests/components/ui/uiDependency.js b/uitest/src/main/resources/com/vaadin/tests/components/ui/uiDependency.js index 4a5775c57f..053a03f41d 100644 --- a/uitest/src/main/resources/com/vaadin/tests/components/ui/uiDependency.js +++ b/uitest/src/main/resources/com/vaadin/tests/components/ui/uiDependency.js @@ -1,24 +1,34 @@ (function() { var loadedBeforeVaadin = (window.vaadin === undefined); - + window.reportUiDependencyStatus = function() { - var styleIndex = 1000; + var style1Index = 1000; + var style2Index = 1000; + var style3Index = 1000; var themeIndex = -1; - + var stylesheets = document.querySelectorAll("link[rel=stylesheet]"); - for(var i = 0; i < stylesheets.length; i++) { + 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; + var href = stylesheet.getAttribute("href"); + if (href.indexOf("uiDependency1.css") > -1) { + style1Index = i; + } else if (href.indexOf("uiDependency2.css") > -1) { + style2Index = i; + } else if (href.indexOf("uiDependency3.css") > -1) { + style3Index = 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); - + + var status = "Script loaded before vaadinBootstrap.js: " + + loadedBeforeVaadin; + status += "<br />Style tag before vaadin theme: " + + (style1Index < themeIndex); + status += "<br />Style tags in correct order: " + + (style1Index < style2Index && style2Index < style3Index); + document.getElementById("statusBox").innerHTML = status; } })();
\ No newline at end of file diff --git a/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency.css b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency1.css index e69de29bb2..e69de29bb2 100644 --- a/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency.css +++ b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency1.css diff --git a/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency2.css b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency2.css new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency2.css diff --git a/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency3.css b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency3.css new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/uitest/src/main/themes/VAADIN/themes/tests-valo/uiDependency3.css diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java index 445d0ffe06..f74c5fa396 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java @@ -30,7 +30,7 @@ public class UiDependenciesInHtmlTest extends SingleBrowserTest { String statusText = findElement(By.id("statusBox")).getText(); Assert.assertEquals( - "Script loaded before vaadinBootstrap.js: true\nStyle tag before vaadin theme: true", + "Script loaded before vaadinBootstrap.js: true\nStyle tag before vaadin theme: true\nStyle tags in correct order: true", statusText); } |