summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-05-07 14:55:27 +0300
committerJohn Ahlroos <john@vaadin.com>2013-05-07 14:57:03 +0300
commitf2c2236cf8d0428f100e17586f7946095ffea158 (patch)
tree080058d6770793571455009ef04e17d0eed1701c
parent9bd7c2bbec7f88e001e81811e02addcaca9fd1a4 (diff)
downloadvaadin-framework-f2c2236cf8d0428f100e17586f7946095ffea158.tar.gz
vaadin-framework-f2c2236cf8d0428f100e17586f7946095ffea158.zip
Replaced css inject hack in TestUtils with Page.Styles.add() #11798
Change-Id: Ifb43fd1d2226756e104e2f5955e23151100e9357
-rw-r--r--uitest/src/com/vaadin/tests/util/TestUtils.java15
1 files changed, 3 insertions, 12 deletions
diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java
index 5c6315a23a..dcd28c3413 100644
--- a/uitest/src/com/vaadin/tests/util/TestUtils.java
+++ b/uitest/src/com/vaadin/tests/util/TestUtils.java
@@ -99,22 +99,13 @@ public class TestUtils {
"YE", "ZAMBIA", "ZM", "ZIMBABWE", "ZW" };
/**
- * Crossbrowser hack to dynamically add css current window. Can be used to
- * keep tests css in source files.
+ * Injects css into the current window. Can be used to keep tests css in
+ * source files.
*
* @param cssString
*/
public static void injectCSS(UI w, String cssString) {
- String script = "if ('\\v'=='v') /* ie only */ {\n"
- + " document.createStyleSheet().cssText = '"
- + cssString
- + "';\n"
- + " } else {var tag = document.createElement('style'); tag.type = 'text/css';"
- + " document.getElementsByTagName('head')[0].appendChild(tag);tag[ (typeof "
- + "document.body.style.WebkitAppearance=='string') /* webkit only */ ? 'innerText' "
- + ": 'innerHTML'] = '" + cssString + "';}";
-
- w.getPage().getJavaScript().execute(script);
+ w.getPage().getStyles().add(cssString);
}
public static void installPerformanceReporting(TextArea targetTextArea) {