summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-05-14 12:22:39 +0000
committerVaadin Code Review <review@vaadin.com>2013-05-14 14:17:28 +0000
commit0a437a54afe019f696bcd1c995cf2588d7337a2b (patch)
tree2bece09f0d54cdc750657a698e89524b6dc71911 /uitest
parent7a1ab60fee06851246c6b3f5c670ea7512d0648d (diff)
downloadvaadin-framework-0a437a54afe019f696bcd1c995cf2588d7337a2b.tar.gz
vaadin-framework-0a437a54afe019f696bcd1c995cf2588d7337a2b.zip
Revert "Replaced css inject hack in TestUtils with Page.Styles.add() #11798"
Removing this change to make the tests behave more nicely until #11848 has been fixed. This reverts commit f2c2236cf8d0428f100e17586f7946095ffea158 Change-Id: I776699f5082273e9c4d11248cc35e7ed6b665873
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/util/TestUtils.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java
index dcd28c3413..5c6315a23a 100644
--- a/uitest/src/com/vaadin/tests/util/TestUtils.java
+++ b/uitest/src/com/vaadin/tests/util/TestUtils.java
@@ -99,13 +99,22 @@ public class TestUtils {
"YE", "ZAMBIA", "ZM", "ZIMBABWE", "ZW" };
/**
- * Injects css into the current window. Can be used to keep tests css in
- * source files.
+ * Crossbrowser hack to dynamically add css current window. Can be used to
+ * keep tests css in source files.
*
* @param cssString
*/
public static void injectCSS(UI w, String cssString) {
- w.getPage().getStyles().add(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);
}
public static void installPerformanceReporting(TextArea targetTextArea) {