summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-05-09 13:29:25 +0300
committerVaadin Code Review <review@vaadin.com>2014-05-09 11:13:45 +0000
commit35c174cfe62477971ed58f17f167e52dc42cace7 (patch)
treeb03cf1ba763e0ae2a8663e5793385c314df25a8b /uitest
parent67dd382e61386043d771126c8ec21794d643baf3 (diff)
downloadvaadin-framework-35c174cfe62477971ed58f17f167e52dc42cace7.tar.gz
vaadin-framework-35c174cfe62477971ed58f17f167e52dc42cace7.zip
Re-apply old change which was excluded from master
The merge script was faulty between May and June 2013 and merged changes individually from both 7.0 and 7.1 to master. In the case that a commit from 7.0 was merged right before there was a "Merge: no" commit in 7.1, the changes between the "Merge: no" commit and the previous merge point from 7.1 to master was potentially never merged (the whole chain was merged as a no-op). The only affected change seems to be 0a437a5 Revert "Replaced css inject hack in TestUtils with Page.Styles.add() #11798" b008768 Implement parenthesis-handling fixes for Sass in Vaadin 7.1 (#12834) The former one is re-applied in this commit, the latter one has been verified to be in the master branch Change-Id: If0cd75d75fdfc8893ac501aab2a0be1b55b09dcc
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) {