Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable scope tests (globals and defaults) #282

Merged
merged 2 commits into from
Mar 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spec/libsass/variable-scoping/defaults/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
div { asd: 9; qwe: 99; zapf: 3; ding: 84; }

div { foo: 42; foo: 99; foo: 999; foo: 999; baz: 9999; }
div div { bar: 9999; bar: 999; }

div { asd: 99; qwe: 42; zap: 3; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
div{asd:9;qwe:99;zapf:3;ding:84}div{foo:42;foo:99;foo:999;foo:999;baz:9999}div div{bar:9999;bar:999}div{asd:99;qwe:42;zap:3}
24 changes: 24 additions & 0 deletions spec/libsass/variable-scoping/defaults/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
div {
asd: 9;
qwe: 99;
zapf: 3;
ding: 84;
}

div {
foo: 42;
foo: 99;
foo: 999;
foo: 999;
baz: 9999;
}
div div {
bar: 9999;
bar: 999;
}

div {
asd: 99;
qwe: 42;
zap: 3;
}
20 changes: 20 additions & 0 deletions spec/libsass/variable-scoping/defaults/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
div {
asd: 9;
qwe: 99;
zapf: 3;
ding: 84; }

div {
foo: 42;
foo: 99;
foo: 999;
foo: 999;
baz: 9999; }
div div {
bar: 9999;
bar: 999; }

div {
asd: 99;
qwe: 42;
zap: 3; }
31 changes: 31 additions & 0 deletions spec/libsass/variable-scoping/defaults/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$i: 9;
$z: 3 !default;
div {
asd: $i;
$i: 99 !global;
$n: 42 !global;
qwe: $i;
zapf: $z;
$z: 84;
ding: $z;
}
div {
foo: $n;
foo: $i;
$i: 999;
$n: 999;
foo: $n;
foo: $i;
div {
$i: 9999;
$n: 9999 !default;
bar: $i;
bar: $n;
}
baz: $i;
}
div {
asd: $i;
qwe: $n;
zap: $z;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
div { x: 42; y: 109; }
div for { y: 89; x: 1; x: 999; y: 94; x: 2; x: 999; y: 99; x: 3; x: 999; y: 104; x: 4; x: 999; y: 109; x: 5; x: 999; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
div{x:42;y:109}div for{y:89;x:1;x:999;y:94;x:2;x:999;y:99;x:3;x:999;y:104;x:4;x:999;y:109;x:5;x:999}
21 changes: 21 additions & 0 deletions spec/libsass/variable-scoping/lexical-scope/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
div {
x: 42;
y: 109;
}
div for {
y: 89;
x: 1;
x: 999;
y: 94;
x: 2;
x: 999;
y: 99;
x: 3;
x: 999;
y: 104;
x: 4;
x: 999;
y: 109;
x: 5;
x: 999;
}
19 changes: 19 additions & 0 deletions spec/libsass/variable-scoping/lexical-scope/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
div {
x: 42;
y: 109; }
div for {
y: 89;
x: 1;
x: 999;
y: 94;
x: 2;
x: 999;
y: 99;
x: 3;
x: 999;
y: 104;
x: 4;
x: 999;
y: 109;
x: 5;
x: 999; }
19 changes: 19 additions & 0 deletions spec/libsass/variable-scoping/lexical-scope/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$x: -42;
$y: -84;
div {
$x: 42;
$y: 84;
for {
@for $x from 1 through 5 {
$y: $y + 5;
y: $y;
x: $x;
$x: 999;
x: $x;
$y: -9 !global;
$x: -9 !global;
}
}
x: $x;
y: $y;
}
2 changes: 2 additions & 0 deletions spec/libsass/variable-scoping/root-scope/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
div { x: -9; y: -9; }
div for { y: -79; x: 1; x: 999; y: -74; x: 2; x: 999; y: -69; x: 3; x: 999; y: -64; x: 4; x: 999; y: -59; x: 5; x: 999; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
div{x:-9;y:-9}div for{y:-79;x:1;x:999;y:-74;x:2;x:999;y:-69;x:3;x:999;y:-64;x:4;x:999;y:-59;x:5;x:999}
21 changes: 21 additions & 0 deletions spec/libsass/variable-scoping/root-scope/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
div {
x: -9;
y: -9;
}
div for {
y: -79;
x: 1;
x: 999;
y: -74;
x: 2;
x: 999;
y: -69;
x: 3;
x: 999;
y: -64;
x: 4;
x: 999;
y: -59;
x: 5;
x: 999;
}
19 changes: 19 additions & 0 deletions spec/libsass/variable-scoping/root-scope/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
div {
x: -9;
y: -9; }
div for {
y: -79;
x: 1;
x: 999;
y: -74;
x: 2;
x: 999;
y: -69;
x: 3;
x: 999;
y: -64;
x: 4;
x: 999;
y: -59;
x: 5;
x: 999; }
17 changes: 17 additions & 0 deletions spec/libsass/variable-scoping/root-scope/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$x: -42;
$y: -84;
div {
for {
@for $x from 1 through 5 {
$y: $y + 5;
y: $y;
x: $x;
$x: 999;
x: $x;
$y: -9 !global;
$x: -9 !global;
}
}
x: $x;
y: $y;
}
1 change: 1 addition & 0 deletions spec/scope/clash/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo { foo: 42; bar: 43; baz: 45; foo: 42; bar: 4; baz: 45; foo: 3; bar: 5; baz: 45; }
1 change: 1 addition & 0 deletions spec/scope/clash/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo{foo:42;bar:43;baz:45;foo:42;bar:4;baz:45;foo:3;bar:5;baz:45}
11 changes: 11 additions & 0 deletions spec/scope/clash/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
foo {
foo: 42;
bar: 43;
baz: 45;
foo: 42;
bar: 4;
baz: 45;
foo: 3;
bar: 5;
baz: 45;
}
10 changes: 10 additions & 0 deletions spec/scope/clash/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
foo {
foo: 42;
bar: 43;
baz: 45;
foo: 42;
bar: 4;
baz: 45;
foo: 3;
bar: 5;
baz: 45; }
24 changes: 24 additions & 0 deletions spec/scope/clash/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$foo: 42;
$bar: 43;
$baz: 45;

foo {
foo: $foo;
bar: $bar;
baz: $baz;

$bar: 4; // this is a different $bar than `$bar !global`

foo: $foo;
bar: $bar;
baz: $baz;

@if true {
$foo: 3; // this is a different $foo than `$foo !global`
$bar: 5; // this is a different $bar than `$bar !global`

foo: $foo;
bar: $bar;
baz: $baz;
}
}
3 changes: 3 additions & 0 deletions spec/scope/each/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo { content: 42; }

.bar { content: 1337; }
1 change: 1 addition & 0 deletions spec/scope/each/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.foo{content:42}.bar{content:1337}
7 changes: 7 additions & 0 deletions spec/scope/each/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.foo {
content: 42;
}

.bar {
content: 1337;
}
5 changes: 5 additions & 0 deletions spec/scope/each/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.foo {
content: 42; }

.bar {
content: 1337; }
13 changes: 13 additions & 0 deletions spec/scope/each/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$foo: 42;

.foo {
content: $foo;
}

@each $item in 1337 {
$foo: $item !global;
}

.bar {
content: $foo;
}
3 changes: 3 additions & 0 deletions spec/scope/for/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo { content: 42; }

.bar { content: 1337; }
1 change: 1 addition & 0 deletions spec/scope/for/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.foo{content:42}.bar{content:1337}
7 changes: 7 additions & 0 deletions spec/scope/for/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.foo {
content: 42;
}

.bar {
content: 1337;
}
5 changes: 5 additions & 0 deletions spec/scope/for/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.foo {
content: 42; }

.bar {
content: 1337; }
13 changes: 13 additions & 0 deletions spec/scope/for/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$foo: 42;

.foo {
content: $foo;
}

@for $i from 1337 to 1338 {
$foo: $i !global;
}

.bar {
content: $foo;
}
3 changes: 3 additions & 0 deletions spec/scope/function/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo { content: 42; }

.bar { content: 1337; }
1 change: 1 addition & 0 deletions spec/scope/function/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.foo{content:42}.bar{content:1337}
7 changes: 7 additions & 0 deletions spec/scope/function/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.foo {
content: 42;
}

.bar {
content: 1337;
}
5 changes: 5 additions & 0 deletions spec/scope/function/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.foo {
content: 42; }

.bar {
content: 1337; }
16 changes: 16 additions & 0 deletions spec/scope/function/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$foo: 42;

.foo {
content: $foo;
}

@function foo() {
$foo: 1337 !global;
@return $foo;
}

@if foo() {}

.bar {
content: $foo;
}
3 changes: 3 additions & 0 deletions spec/scope/if/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo { content: 42; }

.bar { content: 1337; }
1 change: 1 addition & 0 deletions spec/scope/if/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.foo{content:42}.bar{content:1337}
7 changes: 7 additions & 0 deletions spec/scope/if/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.foo {
content: 42;
}

.bar {
content: 1337;
}
5 changes: 5 additions & 0 deletions spec/scope/if/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.foo {
content: 42; }

.bar {
content: 1337; }
Loading