From 35c174cfe62477971ed58f17f167e52dc42cace7 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 9 May 2014 13:29:25 +0300 Subject: [PATCH] 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 --- uitest/src/com/vaadin/tests/util/TestUtils.java | 15 ++++++++++++--- 1 file 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) { -- 2.39.5