summaryrefslogtreecommitdiffstats
path: root/theme-compiler/tests
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2012-09-21 11:52:52 +0300
committerMarc Englund <marc@vaadin.com>2012-09-21 11:53:22 +0300
commit8b28ea439cf09b69574009337c2659dd653d3760 (patch)
treec7e28e1e29b5608115b84f7b0b0cc334fd312455 /theme-compiler/tests
parent9500a714336d6f08b47f7cba980fc82faf318ef3 (diff)
downloadvaadin-framework-8b28ea439cf09b69574009337c2659dd653d3760.tar.gz
vaadin-framework-8b28ea439cf09b69574009337c2659dd653d3760.zip
Big SassCompiler change, fixes #9411 #9489 partials for #9354 #9545 #9380 (applied patch)
Diffstat (limited to 'theme-compiler/tests')
-rw-r--r--theme-compiler/tests/resources/css/control-directives.css28
-rw-r--r--theme-compiler/tests/resources/css/functions.css2
-rw-r--r--theme-compiler/tests/resources/css/microsoft-extensions.css2
-rw-r--r--theme-compiler/tests/resources/css/mixins.css4
-rw-r--r--theme-compiler/tests/resources/css/parent-selector.css4
-rw-r--r--theme-compiler/tests/resources/css/remove-directive.css31
-rw-r--r--theme-compiler/tests/resources/scss/control-directives.scss22
-rw-r--r--theme-compiler/tests/resources/scss/functions.scss4
-rw-r--r--theme-compiler/tests/resources/scss/mixins.scss8
-rw-r--r--theme-compiler/tests/resources/scss/parent-selector.scss10
-rw-r--r--theme-compiler/tests/resources/scss/remove-directive.scss16
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java38
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java9
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java72
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java8
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java25
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/MixinVisitorTest.java25
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/NestedPropertiesVisitorTest.java10
18 files changed, 212 insertions, 106 deletions
diff --git a/theme-compiler/tests/resources/css/control-directives.css b/theme-compiler/tests/resources/css/control-directives.css
index a92cf4b501..83acab53c0 100644
--- a/theme-compiler/tests/resources/css/control-directives.css
+++ b/theme-compiler/tests/resources/css/control-directives.css
@@ -1,26 +1,26 @@
-.salamander-icon #animal, .menu {
- background-image: url(/images/salamander.png);
+.puma-icon #animal, .menu {
+ background-image: url('/images/puma.png');
font-size: 10px;
font-color: blue;
border: 1px solid;
}
-.egret-icon #animal, .menu {
- background-image: url(/images/egret.png);
+.sea-slug-icon #animal, .menu {
+ background-image: url('/images/sea-slug.png');
font-size: 10px;
font-color: blue;
border: 1px solid;
}
-.sea-slug-icon #animal, .menu {
- background-image: url(/images/sea-slug.png);
+.egret-icon #animal, .menu {
+ background-image: url('/images/egret.png');
font-size: 10px;
font-color: blue;
border: 1px solid;
}
-.puma-icon #animal, .menu {
- background-image: url(/images/puma.png);
+.salamander-icon #animal, .menu {
+ background-image: url('/images/salamander.png');
font-size: 10px;
font-color: blue;
border: 1px solid;
@@ -36,4 +36,16 @@
.falseIfTrueElse {
border: 1px solid;
+}
+
+.cube-icon {
+ background-image: url('/images/cube.png');
+}
+
+.triangle-icon {
+ background-image: url('/images/triangle.png');
+}
+
+.circle-icon {
+ background-image: url('/images/circle.png');
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/css/functions.css b/theme-compiler/tests/resources/css/functions.css
index 0fef5d899f..3f6c2bd810 100644
--- a/theme-compiler/tests/resources/css/functions.css
+++ b/theme-compiler/tests/resources/css/functions.css
@@ -11,4 +11,6 @@
color: #200;
color: #f00000;
color: #f00;
+ color: hsl(33, 7%, 89%);
+ color: hsl(33, 7%, 95%);
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/css/microsoft-extensions.css b/theme-compiler/tests/resources/css/microsoft-extensions.css
index 69670969de..18bc34ca6c 100644
--- a/theme-compiler/tests/resources/css/microsoft-extensions.css
+++ b/theme-compiler/tests/resources/css/microsoft-extensions.css
@@ -3,4 +3,4 @@
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=5 ) alpha(opacity = 20);
margin-top: 2px;
margin-left: 2px;
-}
+} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/css/mixins.css b/theme-compiler/tests/resources/css/mixins.css
index 5c727c193b..aefa20ac01 100644
--- a/theme-compiler/tests/resources/css/mixins.css
+++ b/theme-compiler/tests/resources/css/mixins.css
@@ -20,6 +20,10 @@
border-radius: 10px;
}
+.banner {
+ border: 1px solid black;
+}
+
.header {
width: 100%;
}
diff --git a/theme-compiler/tests/resources/css/parent-selector.css b/theme-compiler/tests/resources/css/parent-selector.css
index 9c7140e313..32f8484457 100644
--- a/theme-compiler/tests/resources/css/parent-selector.css
+++ b/theme-compiler/tests/resources/css/parent-selector.css
@@ -21,4 +21,8 @@ body.firefox a {
#main a:hover {
color: red;
+}
+
+.mixin-parent:hover {
+ color: blue;
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/css/remove-directive.css b/theme-compiler/tests/resources/css/remove-directive.css
new file mode 100644
index 0000000000..b7fd2c7e6c
--- /dev/null
+++ b/theme-compiler/tests/resources/css/remove-directive.css
@@ -0,0 +1,31 @@
+.animals .platypus-icon {
+ background-image: url('/images/platypus.png');
+}
+
+.animals .rhinoceros-icon {
+ background-image: url('/images/rhinoceros.png');
+}
+
+.animals .llama-icon {
+ background-image: url('/images/llama.png');
+}
+
+.animals .duck-icon {
+ background-image: url('/images/duck.png');
+}
+
+.animals .duck-icon {
+ background-image: url('/images/duck.png');
+}
+
+.exotic-animals .platypus-icon {
+ background-image: url('/images/platypus.png');
+}
+
+.exotic-animals .rhinoceros-icon {
+ background-image: url('/images/rhinoceros.png');
+}
+
+.exotic-animals .llama-icon {
+ background-image: url('/images/llama.png');
+} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/scss/control-directives.scss b/theme-compiler/tests/resources/scss/control-directives.scss
index f9773bb108..6cf05518bf 100644
--- a/theme-compiler/tests/resources/scss/control-directives.scss
+++ b/theme-compiler/tests/resources/scss/control-directives.scss
@@ -1,13 +1,17 @@
$borderWeight : solid;
-@each $animal in puma, sea-slug, egret, salamander {
- .#{$animal}-icon #animal, .menu {
- background-image: url('/images/#{$animal}.png');
- @include logo(10px);
- @if 1+1 == 2 { border: 1px solid; }
- }
+@mixin animals($list : puma, sea-slug, egret, salamander){
+ @each $animal in $list {
+ .#{$animal}-icon #animal, .menu {
+ background-image: url('/images/#{$animal}.png');
+ @include logo(10px);
+ @if 1+1 == 2 { border: 1px solid; }
+ }
+ }
}
+@include animals;
+
.trueIf {
@if solid != dotted { border: 1px $borderWeight; }
@else { border: 2px solid; }
@@ -24,6 +28,12 @@ $borderWeight : solid;
@else { border: 3px solid; }
}
+@each $thing in cube, triangle, circle{
+ .#{$thing}-icon {
+ background-image: url('/images/#{$thing}.png');
+ }
+}
+
@mixin logo($size){
font: {
size: $size;
diff --git a/theme-compiler/tests/resources/scss/functions.scss b/theme-compiler/tests/resources/scss/functions.scss
index abf6f6187d..b9860311ea 100644
--- a/theme-compiler/tests/resources/scss/functions.scss
+++ b/theme-compiler/tests/resources/scss/functions.scss
@@ -1,3 +1,5 @@
+$base-color : hsl(33, 7%, 89%);
+$app-bg-color : lighten($base-color, 6%);
.main {
margin: abs(-2px);
border: ceil(10.4px);
@@ -11,6 +13,8 @@
color: darken(#800, 20%);
color: lighten(#880000, 20%);
color: lighten(#800, 20%);
+ color : $base-color;
+ color : $app-bg-color;
}
diff --git a/theme-compiler/tests/resources/scss/mixins.scss b/theme-compiler/tests/resources/scss/mixins.scss
index 0fbfed6f93..1f9cdf03de 100644
--- a/theme-compiler/tests/resources/scss/mixins.scss
+++ b/theme-compiler/tests/resources/scss/mixins.scss
@@ -54,4 +54,12 @@ $mixinVar : 1px;
}
}
+.banner {
+ @include fontType(1px solid black);
+}
+
+@mixin fontType($border){
+ border : $border;
+}
+
@include layout; \ No newline at end of file
diff --git a/theme-compiler/tests/resources/scss/parent-selector.scss b/theme-compiler/tests/resources/scss/parent-selector.scss
index 3d0f694801..60e7608c07 100644
--- a/theme-compiler/tests/resources/scss/parent-selector.scss
+++ b/theme-compiler/tests/resources/scss/parent-selector.scss
@@ -11,4 +11,14 @@ a {
font-weight: bold;
&:hover { color: red; }
}
+}
+
+@mixin parent {
+ &:hover {
+ color: blue;
+ }
+}
+
+.mixin-parent {
+ @include parent;
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/scss/remove-directive.scss b/theme-compiler/tests/resources/scss/remove-directive.scss
new file mode 100644
index 0000000000..cbfca9dcda
--- /dev/null
+++ b/theme-compiler/tests/resources/scss/remove-directive.scss
@@ -0,0 +1,16 @@
+$animals : platypus, rhinoceros, llama, duck, duck;
+$remove : duck;
+
+@each $animal in $animals {
+ .animals .#{$animal}-icon {
+ background-image: url('/images/#{$animal}.png');
+ }
+}
+
+remove($animals, $remove, space);
+
+@each $animal in $animals{
+ .exotic-animals .#{$animal}-icon {
+ background-image: url('/images/#{$animal}.png');
+ }
+}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java
index f6b32e32a2..7a0f1f1a25 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java
@@ -29,7 +29,12 @@ import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.handler.SCSSDocumentHandler;
import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
import com.vaadin.sass.parser.Parser;
+import com.vaadin.sass.tree.BlockNode;
+import com.vaadin.sass.tree.MixinDefNode;
+import com.vaadin.sass.tree.MixinNode;
import com.vaadin.sass.tree.Node;
+import com.vaadin.sass.tree.controldirective.EachDefNode;
+import com.vaadin.sass.tree.controldirective.IfElseDefNode;
public class ControlDirectives extends AbstractTestBase {
@@ -46,24 +51,21 @@ public class ControlDirectives extends AbstractTestBase {
Assert.assertNotNull(root);
ArrayList<Node> children = root.getChildren();
- Assert.assertEquals(6, root.getChildren().size());
- //
- // Assert.assertTrue(children.get(1) instanceof EachDefNode);
- // Assert.assertTrue(children.get(2) instanceof BlockNode);
- // Assert.assertTrue(children.get(3) instanceof BlockNode);
- // Assert.assertTrue(children.get(4) instanceof BlockNode);
- // Assert.assertTrue(children.get(5) instanceof MixinDefNode);
- //
- // Assert.assertTrue(children.get(2).getChildren().get(0) instanceof
- // IfElseDefNode);
- // Assert.assertTrue(children.get(3).getChildren().get(0) instanceof
- // IfElseDefNode);
- // Assert.assertTrue(children.get(4).getChildren().get(0) instanceof
- // IfElseDefNode);
- // Assert.assertTrue(!(children.get(5).getChildren().get(0) instanceof
- // IfElseDefNode));
- //
- // Assert.assertEquals(1, children.get(1).getChildren().size());
+ Assert.assertEquals(8, root.getChildren().size());
+
+ Assert.assertTrue(children.get(1) instanceof MixinDefNode);
+ Assert.assertTrue(children.get(2) instanceof MixinNode);
+ Assert.assertTrue(children.get(3) instanceof BlockNode);
+ Assert.assertTrue(children.get(4) instanceof BlockNode);
+ Assert.assertTrue(children.get(5) instanceof BlockNode);
+ Assert.assertTrue(children.get(7) instanceof MixinDefNode);
+
+ Assert.assertTrue(children.get(1).getChildren().get(0) instanceof EachDefNode);
+ Assert.assertTrue(children.get(3).getChildren().get(0) instanceof IfElseDefNode);
+ Assert.assertTrue(children.get(4).getChildren().get(0) instanceof IfElseDefNode);
+ Assert.assertTrue(!(children.get(7).getChildren().get(0) instanceof IfElseDefNode));
+
+ Assert.assertEquals(1, children.get(1).getChildren().size());
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java
index d2e890c052..cc6d67795c 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java
@@ -18,8 +18,7 @@ package com.vaadin.sass.testcases.scss;
import java.io.IOException;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
import org.w3c.css.sac.CSSException;
@@ -42,9 +41,9 @@ public class Functions extends AbstractTestBase {
parser.setDocumentHandler(handler);
parser.parseStyleSheet(getClass().getResource(scss).getPath());
ScssStylesheet root = handler.getStyleSheet();
- Assert.assertEquals(1, root.getChildren().size());
- BlockNode blockNode = (BlockNode) root.getChildren().get(0);
- Assert.assertEquals(12, blockNode.getChildren().size());
+ Assert.assertEquals(3, root.getChildren().size());
+ BlockNode blockNode = (BlockNode) root.getChildren().get(2);
+ Assert.assertEquals(14, blockNode.getChildren().size());
}
@Test
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java
index 4efa88275f..ac3ad20e15 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java
@@ -29,6 +29,7 @@ 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.LexicalUnitImpl;
import com.vaadin.sass.parser.Parser;
import com.vaadin.sass.tree.BlockNode;
import com.vaadin.sass.tree.MixinDefNode;
@@ -71,48 +72,37 @@ public class Mixins extends AbstractTestBase {
Assert.assertEquals(3, mainBlockNode.getChildren().size());
MixinNode mixinNode0MainBlock = (MixinNode) mainBlockNode.getChildren()
.get(0);
- // Assert.assertEquals("rounded-borders",
- // mixinNode0MainBlock.getName());
- // Assert.assertEquals(1f, mixinNode0MainBlock.getArglist().get(0)
- // .getFloatValue());
- // Assert.assertEquals(LexicalUnit.SAC_PIXEL, mixinNode0MainBlock
- // .getArglist().get(0).getLexicalUnitType());
- // MixinNode mixinNOde1MainBlock = (MixinNode)
- // mainBlockNode.getChildren()
- // .get(1);
- // Assert.assertEquals("font-settings", mixinNOde1MainBlock.getName());
- // Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty());
- //
- // MixinNode mixinNOde2MainBlock = (MixinNode)
- // mainBlockNode.getChildren()
- // .get(2);
- // Assert.assertEquals("main-details", mixinNOde2MainBlock.getName());
- // Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty());
- //
- // MixinNode mixinNode1MainBlock = (MixinNode)
- // mainBlockNode.getChildren()
- // .get(1);
- // Assert.assertTrue(mixinNode1MainBlock.getArglist().isEmpty());
- //
- // BlockNode footerBlockNode = (BlockNode) root.getChildren().get(3);
- // MixinNode mixinNodeFooterBlock = (MixinNode) footerBlockNode
- // .getChildren().get(0);
- // Assert.assertEquals(2f, mixinNodeFooterBlock.getArglist().get(0)
- // .getFloatValue());
- // Assert.assertEquals("px", mixinNodeFooterBlock.getArglist().get(0)
- // .getDimensionUnitText());
- //
- // Assert.assertEquals(10f, mixinNodeFooterBlock.getArglist().get(1)
- // .getFloatValue());
- // Assert.assertEquals("px", mixinNodeFooterBlock.getArglist().get(1)
- // .getDimensionUnitText());
- //
- // Assert.assertTrue(root.getChildren().get(4) instanceof MixinDefNode);
- // Assert.assertTrue(root.getChildren().get(4).getChildren().get(3)
- // instanceof MediaNode);
- // Assert.assertTrue(root.getChildren().get(4).getChildren().get(4)
- // instanceof MixinNode);
+ Assert.assertEquals("rounded-borders", mixinNode0MainBlock.getName());
+ Assert.assertEquals("mixinVar", mixinNode0MainBlock.getArglist().get(0)
+ .getStringValue());
+ Assert.assertEquals(LexicalUnitImpl.SCSS_VARIABLE, mixinNode0MainBlock
+ .getArglist().get(0).getLexicalUnitType());
+ MixinNode mixinNOde1MainBlock = (MixinNode) mainBlockNode.getChildren()
+ .get(1);
+ Assert.assertEquals("font-settings", mixinNOde1MainBlock.getName());
+ Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty());
+ MixinNode mixinNOde2MainBlock = (MixinNode) mainBlockNode.getChildren()
+ .get(2);
+ Assert.assertEquals("main-details", mixinNOde2MainBlock.getName());
+ Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty());
+
+ MixinNode mixinNode1MainBlock = (MixinNode) mainBlockNode.getChildren()
+ .get(1);
+ Assert.assertTrue(mixinNode1MainBlock.getArglist().isEmpty());
+
+ BlockNode footerBlockNode = (BlockNode) root.getChildren().get(3);
+ MixinNode mixinNodeFooterBlock = (MixinNode) footerBlockNode
+ .getChildren().get(0);
+ Assert.assertEquals("mixinVar", mixinNodeFooterBlock.getArglist()
+ .get(0).getStringValue());
+
+ Assert.assertTrue(root.getChildren().get(0) instanceof MixinDefNode);
+ Assert.assertTrue(root.getChildren().get(1) instanceof MixinDefNode);
+ Assert.assertTrue(root.getChildren().get(5) instanceof MixinDefNode);
+ Assert.assertTrue(root.getChildren().get(6) instanceof MixinDefNode);
+ Assert.assertTrue(root.getChildren().get(8) instanceof MixinDefNode);
+ Assert.assertTrue(root.getChildren().get(9) instanceof MixinNode);
}
@Test
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
index 7ac2450bfc..7f3b3d6551 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
@@ -28,7 +28,6 @@ import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.handler.SCSSDocumentHandler;
import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.selector.SelectorUtil;
import com.vaadin.sass.tree.BlockNode;
public class ParentSelector extends AbstractTestBase {
@@ -45,11 +44,10 @@ public class ParentSelector extends AbstractTestBase {
BlockNode blockNode = (BlockNode) root.getChildren().get(0);
Assert.assertEquals(4, blockNode.getChildren().size());
BlockNode nestedBlock1 = (BlockNode) blockNode.getChildren().get(2);
- Assert.assertEquals("&:hover",
- SelectorUtil.toString(nestedBlock1.getSelectorList()));
+ Assert.assertEquals("&:hover", nestedBlock1.getSelectorList().get(0));
BlockNode nestedBlock2 = (BlockNode) blockNode.getChildren().get(3);
- Assert.assertEquals("body.firefox &",
- SelectorUtil.toString(nestedBlock2.getSelectorList()));
+ Assert.assertEquals("body.firefox &", nestedBlock2.getSelectorList()
+ .get(0));
}
@Test
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java
new file mode 100644
index 0000000000..e9e87e7b56
--- /dev/null
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java
@@ -0,0 +1,25 @@
+package com.vaadin.sass.testcases.scss;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.w3c.css.sac.CSSException;
+
+import com.vaadin.sass.AbstractTestBase;
+
+public class RemoveDirective extends AbstractTestBase {
+
+ String scss = "/scss/remove-directive.scss";
+ String css = "/css/remove-directive.css";
+
+ @Test
+ public void testParser() throws CSSException, IOException {
+
+ }
+
+ @Test
+ public void testCompiler() throws Exception {
+ testCompiler(scss, css);
+ }
+
+}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/MixinVisitorTest.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/MixinVisitorTest.java
index 46d6efbeac..56a35807d1 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/MixinVisitorTest.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/MixinVisitorTest.java
@@ -20,10 +20,9 @@ import java.util.ArrayList;
import org.junit.Assert;
import org.junit.Test;
-import org.w3c.css.sac.LexicalUnit;
-import com.steadystate.css.parser.LexicalUnitImpl;
import com.vaadin.sass.ScssStylesheet;
+import com.vaadin.sass.parser.LexicalUnitImpl;
import com.vaadin.sass.parser.SCSSLexicalUnit;
import com.vaadin.sass.tree.BlockNode;
import com.vaadin.sass.tree.MixinDefNode;
@@ -72,8 +71,10 @@ public class MixinVisitorTest {
root.appendChild(mixinDefWithNonDefaultArg);
BlockNode blockWithMixin = new BlockNode(null);
- ArrayList<LexicalUnit> includeArgs = new ArrayList<LexicalUnit>();
- LexicalUnit includeArg = LexicalUnitImpl.createPixel(null, 1f);
+ ArrayList<LexicalUnitImpl> includeArgs = new ArrayList<LexicalUnitImpl>();
+ LexicalUnitImpl includeArg = LexicalUnitImpl.createPixel(1f);
+ includeArg.setLexicalUnitType(LexicalUnitImpl.SAC_PIXEL);
+ includeArg.setFloatValue(1);
includeArgs.add(includeArg);
MixinNode mixin = new MixinNode("non-default-arg", includeArgs);
blockWithMixin.appendChild(mixin);
@@ -96,8 +97,8 @@ public class MixinVisitorTest {
public void testTraverseMixinWithDefaultArgs() {
ScssStylesheet root = new ScssStylesheet();
ArrayList<VariableNode> args = new ArrayList<VariableNode>();
- args.add(new VariableNode("arg", LexicalUnitImpl.createPixel(null, 1f),
- false));
+ LexicalUnitImpl includeArg = LexicalUnitImpl.createPixel(1f);
+ args.add(new VariableNode("arg", includeArg, false));
MixinDefNode mixinDefWithNonDefaultArg = new MixinDefNode(
"default-arg", args);
BlockNode blockNode = new BlockNode(null);
@@ -135,16 +136,16 @@ public class MixinVisitorTest {
MixinDefNode mixinDefNoArgs = new MixinDefNode("table-base", null);
BlockNode thBlockNode = new BlockNode(null);
RuleNode textAlignRuleNode = new RuleNode("text-align",
- LexicalUnitImpl.createString(null, "center"), false, null);
+ LexicalUnitImpl.createString("center"), false, null);
thBlockNode.appendChild(textAlignRuleNode);
RuleNode fontWeightRuleNode = new RuleNode("font-weight",
- LexicalUnitImpl.createString(null, "bold"), false, null);
+ LexicalUnitImpl.createString("bold"), false, null);
thBlockNode.appendChild(fontWeightRuleNode);
mixinDefNoArgs.appendChild(thBlockNode);
BlockNode tdthBlockNode = new BlockNode(null);
RuleNode paddingRuleNode = new RuleNode("padding",
- LexicalUnitImpl.createPixel(null, 2f), false, null);
+ LexicalUnitImpl.createPixel(2f), false, null);
tdthBlockNode.appendChild(paddingRuleNode);
mixinDefNoArgs.appendChild(tdthBlockNode);
root.appendChild(mixinDefNoArgs);
@@ -205,7 +206,7 @@ public class MixinVisitorTest {
MixinDefNode mixinDef = new MixinDefNode("left", argNameList);
RuleNode floatRuleNode = new RuleNode("float",
- LexicalUnitImpl.createString(null, "left"), false, null);
+ LexicalUnitImpl.createString("left"), false, null);
mixinDef.appendChild(floatRuleNode);
RuleNode marginLeftRuleNode = new RuleNode("margin-left",
com.vaadin.sass.parser.LexicalUnitImpl.createVariable(0, 0,
@@ -214,8 +215,8 @@ public class MixinVisitorTest {
root.appendChild(mixinDef);
BlockNode dataBlock = new BlockNode(null);
- ArrayList<LexicalUnit> argValueList = new ArrayList<LexicalUnit>();
- LexicalUnit arg = LexicalUnitImpl.createPixel(null, 10f);
+ ArrayList<LexicalUnitImpl> argValueList = new ArrayList<LexicalUnitImpl>();
+ LexicalUnitImpl arg = LexicalUnitImpl.createPixel(10f);
argValueList.add(arg);
MixinNode mixinNode = new MixinNode("left", argValueList);
dataBlock.appendChild(mixinNode);
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/NestedPropertiesVisitorTest.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/NestedPropertiesVisitorTest.java
index 3885869b72..eafdb4908f 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/NestedPropertiesVisitorTest.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/visitor/NestedPropertiesVisitorTest.java
@@ -22,7 +22,6 @@ import org.junit.Test;
import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.tree.NestPropertiesNode;
import com.vaadin.sass.tree.RuleNode;
-import com.vaadin.sass.tree.VariableNode;
import com.vaadin.sass.visitor.NestPropertiesVisitor;
public class NestedPropertiesVisitorTest {
@@ -37,15 +36,6 @@ public class NestedPropertiesVisitorTest {
}
@Test
- public void testNoNestPropertiesNodeNoChange() {
- ScssStylesheet root = new ScssStylesheet();
- root.appendChild(new VariableNode("", ""));
- Assert.assertEquals(1, root.getChildren().size());
- visitor.traverse(root);
- Assert.assertEquals(1, root.getChildren().size());
- }
-
- @Test
public void testNestedPropertiesCanBeUnnested() {
ScssStylesheet root = new ScssStylesheet();
NestPropertiesNode nested = new NestPropertiesNode("nested");