summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHaijian Wang <haijian@vaadin.com>2012-08-21 12:41:52 +0300
committerHaijian Wang <haijian@vaadin.com>2012-08-21 12:41:52 +0300
commit3d757bddfc2a07a77879fb3310e6dbbc49a1a079 (patch)
tree260122b3b511a238f6975c19d06fbed2d213c8d5 /tests
parentcc13349d7c0526cfda81fb846b4565a2e7af5d76 (diff)
downloadvaadin-framework-3d757bddfc2a07a77879fb3310e6dbbc49a1a079.tar.gz
vaadin-framework-3d757bddfc2a07a77879fb3310e6dbbc49a1a079.zip
fixed the hsl bug reported by Jouni, it is caused by the LexicalUnitImpl replace function and the updateVaule function in VariableVisitor
Diffstat (limited to 'tests')
-rw-r--r--tests/sass/resources/css/var-guarded.css4
-rw-r--r--tests/sass/resources/scss/var-guarded.scss8
-rw-r--r--tests/sass/src/com/vaadin/sass/testcases/scss/VariableGuarded.java36
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/sass/resources/css/var-guarded.css b/tests/sass/resources/css/var-guarded.css
new file mode 100644
index 0000000000..c4a8c49d12
--- /dev/null
+++ b/tests/sass/resources/css/var-guarded.css
@@ -0,0 +1,4 @@
+#main {
+ content: "First content";
+ new-content: "First time reference";
+} \ No newline at end of file
diff --git a/tests/sass/resources/scss/var-guarded.scss b/tests/sass/resources/scss/var-guarded.scss
new file mode 100644
index 0000000000..8f7aab8fa9
--- /dev/null
+++ b/tests/sass/resources/scss/var-guarded.scss
@@ -0,0 +1,8 @@
+$content: "First content";
+$content: "Second content?" !default;
+$new_content: "First time reference" !default;
+
+#main {
+ content: $content;
+ new-content: $new_content;
+} \ No newline at end of file
diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/VariableGuarded.java b/tests/sass/src/com/vaadin/sass/testcases/scss/VariableGuarded.java
new file mode 100644
index 0000000000..2c37737e69
--- /dev/null
+++ b/tests/sass/src/com/vaadin/sass/testcases/scss/VariableGuarded.java
@@ -0,0 +1,36 @@
+package com.vaadin.sass.testcases.scss;
+
+import java.io.IOException;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.w3c.css.sac.CSSException;
+
+import com.vaadin.sass.AbstractTestBase;
+import com.vaadin.sass.ScssStylesheet;
+import com.vaadin.sass.handler.SCSSDocumentHandler;
+import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.parser.Parser;
+
+public class VariableGuarded extends AbstractTestBase {
+ String scss = "/scss/var-guarded.scss";
+ String css = "/css/var-guarded.css";
+
+ @Test
+ public void testParser() throws CSSException, IOException {
+ Parser parser = new Parser();
+ SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
+ parser.setDocumentHandler(handler);
+ parser.parseStyleSheet(getClass().getResource(scss).getPath());
+ ScssStylesheet root = handler.getStyleSheet();
+ Assert.assertEquals(4, root.getChildren().size());
+ }
+
+ @Test
+ public void testCompiler() throws Exception {
+ testCompiler(scss, css);
+ Assert.assertEquals("Original CSS and parsed CSS doesn't match",
+ comparisonCss, parsedScss);
+ }
+}