diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sass/resources/css/var-guarded.css | 4 | ||||
-rw-r--r-- | tests/sass/resources/scss/var-guarded.scss | 8 | ||||
-rw-r--r-- | tests/sass/src/com/vaadin/sass/testcases/scss/VariableGuarded.java | 36 |
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); + } +} |