From 0a2b6b5127f97bededd4b84926d656b9dd4a3032 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 18 Apr 2013 10:36:31 +0300 Subject: Support "to" in CSS function parameters (#11309) This change also relaxes whitespace checking in SCSS tests slightly. Change-Id: I2ad5087e7d77ddd0473df47d202c6dd3e228181f --- .../tests/resources/automatic/css/gradient.css | 17 +++++++++++++++++ .../tests/resources/automatic/scss/gradient.scss | 17 +++++++++++++++++ ..._newlines_removed_from_selectors_when_compressed.css | 4 ++++ ...newlines_removed_from_selectors_when_compressed.scss | 6 ++++++ ..._newlines_removed_from_selectors_when_compressed.css | 4 ---- ...newlines_removed_from_selectors_when_compressed.scss | 6 ------ .../scss/AbstractDirectoryScanningSassTests.java | 13 +++++++++---- 7 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 theme-compiler/tests/resources/automatic/css/gradient.css create mode 100644 theme-compiler/tests/resources/automatic/scss/gradient.scss create mode 100644 theme-compiler/tests/resources/sasslang/css/385-test_newlines_removed_from_selectors_when_compressed.css create mode 100644 theme-compiler/tests/resources/sasslang/scss/385-test_newlines_removed_from_selectors_when_compressed.scss delete mode 100644 theme-compiler/tests/resources/sasslangbroken/css/385-test_newlines_removed_from_selectors_when_compressed.css delete mode 100644 theme-compiler/tests/resources/sasslangbroken/scss/385-test_newlines_removed_from_selectors_when_compressed.scss (limited to 'theme-compiler/tests') diff --git a/theme-compiler/tests/resources/automatic/css/gradient.css b/theme-compiler/tests/resources/automatic/css/gradient.css new file mode 100644 index 0000000000..c304d5fc36 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/gradient.css @@ -0,0 +1,17 @@ + .top-gradient { + background: -moz-linear-gradient( + top, + rgb(216,220,225) 0, + rgb(255,255,255) 1em, + rgb(255,255,255) 100%); + background: -webkit-linear-gradient( + top, + rgb(216,220,225) 0, + rgb(255,255,255) 1em, + rgb(255,255,255) 100%); + background: linear-gradient( + to bottom, + rgb(216,220,225) 0%, + rgb(255,255,255) 5%, + rgb(255,255,255) 100%); + } \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/gradient.scss b/theme-compiler/tests/resources/automatic/scss/gradient.scss new file mode 100644 index 0000000000..c304d5fc36 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/gradient.scss @@ -0,0 +1,17 @@ + .top-gradient { + background: -moz-linear-gradient( + top, + rgb(216,220,225) 0, + rgb(255,255,255) 1em, + rgb(255,255,255) 100%); + background: -webkit-linear-gradient( + top, + rgb(216,220,225) 0, + rgb(255,255,255) 1em, + rgb(255,255,255) 100%); + background: linear-gradient( + to bottom, + rgb(216,220,225) 0%, + rgb(255,255,255) 5%, + rgb(255,255,255) 100%); + } \ No newline at end of file diff --git a/theme-compiler/tests/resources/sasslang/css/385-test_newlines_removed_from_selectors_when_compressed.css b/theme-compiler/tests/resources/sasslang/css/385-test_newlines_removed_from_selectors_when_compressed.css new file mode 100644 index 0000000000..5032ec877d --- /dev/null +++ b/theme-compiler/tests/resources/sasslang/css/385-test_newlines_removed_from_selectors_when_compressed.css @@ -0,0 +1,4 @@ +z a +, z b { + display: block; +} diff --git a/theme-compiler/tests/resources/sasslang/scss/385-test_newlines_removed_from_selectors_when_compressed.scss b/theme-compiler/tests/resources/sasslang/scss/385-test_newlines_removed_from_selectors_when_compressed.scss new file mode 100644 index 0000000000..c04a1ee63a --- /dev/null +++ b/theme-compiler/tests/resources/sasslang/scss/385-test_newlines_removed_from_selectors_when_compressed.scss @@ -0,0 +1,6 @@ +a +, b { + z & { + display: block; + } +} diff --git a/theme-compiler/tests/resources/sasslangbroken/css/385-test_newlines_removed_from_selectors_when_compressed.css b/theme-compiler/tests/resources/sasslangbroken/css/385-test_newlines_removed_from_selectors_when_compressed.css deleted file mode 100644 index 5032ec877d..0000000000 --- a/theme-compiler/tests/resources/sasslangbroken/css/385-test_newlines_removed_from_selectors_when_compressed.css +++ /dev/null @@ -1,4 +0,0 @@ -z a -, z b { - display: block; -} diff --git a/theme-compiler/tests/resources/sasslangbroken/scss/385-test_newlines_removed_from_selectors_when_compressed.scss b/theme-compiler/tests/resources/sasslangbroken/scss/385-test_newlines_removed_from_selectors_when_compressed.scss deleted file mode 100644 index c04a1ee63a..0000000000 --- a/theme-compiler/tests/resources/sasslangbroken/scss/385-test_newlines_removed_from_selectors_when_compressed.scss +++ /dev/null @@ -1,6 +0,0 @@ -a -, b { - z & { - display: block; - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java index 47657f805c..40da6179f6 100644 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java +++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java @@ -33,7 +33,7 @@ import org.junit.Assert; import com.vaadin.sass.internal.ScssStylesheet; import com.vaadin.sass.testcases.scss.SassTestRunner.FactoryTest; -public abstract class AbstractDirectoryScanningSassTests { +public abstract class AbstractDirectoryScanningSassTests { public static Collection getScssResourceNames(URL directoryUrl) throws URISyntaxException { @@ -73,14 +73,19 @@ public abstract class AbstractDirectoryScanningSassTests { scssStylesheet.compile(); String parsedCss = scssStylesheet.toString(); + String normalizedReference = normalize(referenceCss); + String normalizedParsed = normalize(parsedCss); Assert.assertEquals("Original CSS and parsed CSS do not match for " - + scssResourceName, normalize(referenceCss), - normalize(parsedCss)); + + scssResourceName, normalizedReference, normalizedParsed); } private String normalize(String css) { - // Replace all whitespace characters with a single space + // Insert whitespace at each point css = css.replaceAll("[\n\r\t ]*", " "); + // Replace multiple whitespace characters with a single space to compact + css = css.replaceAll("[\n\r\t ]+", " "); + // remove initial whitespace + css = css.replaceAll("^[\n\r\t ]*", ""); // remove trailing whitespace css = css.replaceAll("[\n\r\t ]*$", ""); return css; -- cgit v1.2.3