diff options
author | Henri Sara <hesara@vaadin.com> | 2012-08-08 17:02:33 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-08-08 17:02:33 +0300 |
commit | 3580acbd26e877db0e79bb9fa5b46d947ce619c4 (patch) | |
tree | 34b91908f2ba708c9b0a4a3811e9c704df602d02 /tests | |
parent | cfa455d6cfd4a535fd77cbc76637a57e7024e9ac (diff) | |
download | vaadin-framework-3580acbd26e877db0e79bb9fa5b46d947ce619c4.tar.gz vaadin-framework-3580acbd26e877db0e79bb9fa5b46d947ce619c4.zip |
Apply changeset from SASS repository: comment handling
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sass/resources/css/comments.css (renamed from tests/sass/resources/basic/comments.css) | 2 | ||||
-rw-r--r-- | tests/sass/resources/scss/comments.scss | 12 | ||||
-rw-r--r-- | tests/sass/src/com/vaadin/sass/CssTestSuite.java | 4 | ||||
-rw-r--r-- | tests/sass/src/com/vaadin/sass/ScssTestSuite.java | 3 | ||||
-rw-r--r-- | tests/sass/src/com/vaadin/sass/testcases/css/Comments.java | 23 | ||||
-rw-r--r-- | tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java | 43 |
6 files changed, 60 insertions, 27 deletions
diff --git a/tests/sass/resources/basic/comments.css b/tests/sass/resources/css/comments.css index 96d6b312c8..32f348da9e 100644 --- a/tests/sass/resources/basic/comments.css +++ b/tests/sass/resources/css/comments.css @@ -1,3 +1,5 @@ +/** 0sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +/** 1sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ .v-button:focus { background-image: url(img/left-focus.png);/** sprite-ref: buttons */ outline: none; diff --git a/tests/sass/resources/scss/comments.scss b/tests/sass/resources/scss/comments.scss new file mode 100644 index 0000000000..7e2ccac3b5 --- /dev/null +++ b/tests/sass/resources/scss/comments.scss @@ -0,0 +1,12 @@ +/** 0sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +$black:#000000; +/** 1sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +.v-button:focus { + background-image: url(img/left-focus.png);/** sprite-ref: buttons */ + outline: none; +} + +.v-button:focus .v-button-wrap { + background-image: url(img/right-focus.png);/** sprite-ref: buttons; sprite-alignment: right */ + outline: none; +}
\ No newline at end of file diff --git a/tests/sass/src/com/vaadin/sass/CssTestSuite.java b/tests/sass/src/com/vaadin/sass/CssTestSuite.java index e15da68e0c..0ee1f79450 100644 --- a/tests/sass/src/com/vaadin/sass/CssTestSuite.java +++ b/tests/sass/src/com/vaadin/sass/CssTestSuite.java @@ -4,14 +4,12 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import com.vaadin.sass.testcases.css.Comments; import com.vaadin.sass.testcases.css.Media; import com.vaadin.sass.testcases.css.Properties; import com.vaadin.sass.testcases.css.Reindeer; import com.vaadin.sass.testcases.css.Selectors; @RunWith(Suite.class) -@SuiteClasses({ Selectors.class, Properties.class, Reindeer.class, Media.class, - Comments.class }) +@SuiteClasses({ Selectors.class, Properties.class, Reindeer.class, Media.class, }) public class CssTestSuite { } diff --git a/tests/sass/src/com/vaadin/sass/ScssTestSuite.java b/tests/sass/src/com/vaadin/sass/ScssTestSuite.java index 9ab0a76597..5a5351577d 100644 --- a/tests/sass/src/com/vaadin/sass/ScssTestSuite.java +++ b/tests/sass/src/com/vaadin/sass/ScssTestSuite.java @@ -4,6 +4,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; +import com.vaadin.sass.testcases.scss.Comments; import com.vaadin.sass.testcases.scss.ControlDirectives; import com.vaadin.sass.testcases.scss.Extends; import com.vaadin.sass.testcases.scss.Functions; @@ -20,7 +21,7 @@ import com.vaadin.sass.tree.ImportNodeTest; @SuiteClasses({ ControlDirectives.class, Extends.class, Functions.class, ImportNodeTest.class, Imports.class, Mixins.class, NestedProperties.class, Nesting.class, ParentImports.class, - Variables.class, ParentSelector.class }) + Variables.class, ParentSelector.class, Comments.class }) public class ScssTestSuite { } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/Comments.java b/tests/sass/src/com/vaadin/sass/testcases/css/Comments.java deleted file mode 100644 index c0690418e2..0000000000 --- a/tests/sass/src/com/vaadin/sass/testcases/css/Comments.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.TestBase; - -public class Comments extends TestBase { - String css = "/basic/comments.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); - } -} diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java new file mode 100644 index 0000000000..bca87d268f --- /dev/null +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java @@ -0,0 +1,43 @@ +package com.vaadin.sass.testcases.scss; + +import java.io.IOException; +import java.net.URISyntaxException; + +import junit.framework.Assert; + +import org.junit.Test; +import org.w3c.css.sac.CSSException; + +import com.vaadin.sass.ScssStylesheet; +import com.vaadin.sass.TestBase; +import com.vaadin.sass.handler.SCSSDocumentHandler; +import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; +import com.vaadin.sass.parser.Parser; +import com.vaadin.sass.tree.CommentNode; + +public class Comments extends TestBase { + String scss = "/scss/comments.scss"; + String css = "/scss/comments.css"; + + @Test + public void testParser() throws CSSException, URISyntaxException, + IOException { + Parser parser = new Parser(); + SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); + parser.setDocumentHandler(handler); + parser.parseStyleSheet(getClass().getResource(scss).getPath()); + ScssStylesheet root = handler.getStyleSheet(); + Assert.assertNotNull(root); + Assert.assertEquals(5, root.getChildren().size()); + Assert.assertTrue(root.getChildren().get(0) instanceof CommentNode); + Assert.assertTrue(root.getChildren().get(2) instanceof CommentNode); + } + + @Test + public void testCompiler() throws CSSException, URISyntaxException, + IOException { + testCompiler(scss, css); + Assert.assertEquals("Original CSS and parsed CSS doesn't match", + comparisonCss, parsedScss); + } +} |