-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preparing unit tests for #186 (detached rulesets)
- Loading branch information
meri
committed
Apr 9, 2014
1 parent
a9b4a2a
commit d0d1d99
Showing
8 changed files
with
423 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/test/resources/compile-basic-features/detached-rulesets/detached-ruleset-in-list.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
selector { | ||
property: 2; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/compile-basic-features/detached-rulesets/detached-ruleset-in-list.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@detached-ruleset1: { property: 1; }; | ||
@detached-ruleset2: { property: 2; }; | ||
@list: @detached-ruleset1 @detached-ruleset2; | ||
|
||
selector { | ||
@set: extract(@list, 2); | ||
@set(); | ||
} |
71 changes: 71 additions & 0 deletions
71
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-basics.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.selector { | ||
background: green; | ||
} | ||
@media (min-width: 1200) { | ||
.selector { | ||
padding: 0; | ||
} | ||
} | ||
.call-with-parentheses { | ||
background: red; | ||
} | ||
.call-with-parentheses .selector { | ||
background: green; | ||
} | ||
@media (min-width: 1200) { | ||
.call-with-parentheses .selector { | ||
padding: 0; | ||
} | ||
} | ||
@media screen { | ||
background: red; | ||
|
||
.selector { | ||
background: green; | ||
} | ||
} | ||
@media screen and (min-width: 1200) { | ||
.selector { | ||
padding: 0; | ||
} | ||
} | ||
.mixin-with-arguments-enclosure .custom-mixin-argument { | ||
custom: custom; | ||
} | ||
.see-caller use-place { | ||
caller-variable: value; | ||
property: default; | ||
property: global default; | ||
} | ||
.see-caller use-place { | ||
caller-variable: declaration; | ||
variable: declaration; | ||
} | ||
.see-caller-caller use-place { | ||
property: default; | ||
property: global default; | ||
} | ||
.default { | ||
property: default; | ||
} | ||
.custom { | ||
property: custom; | ||
} | ||
.default { | ||
property: global default; | ||
} | ||
.custom { | ||
property: custom; | ||
} | ||
.caller { | ||
property: caller; | ||
} | ||
.caller .default { | ||
property: caller; | ||
} | ||
.caller .custom { | ||
property: custom; | ||
} | ||
.caller { | ||
value: in detached; | ||
} |
155 changes: 155 additions & 0 deletions
155
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-basics.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
@one-rule: { background: red; }; | ||
@ruleset: { .selector { background: green; } }; | ||
@ruleset-second: { .selector { size: 2; } }; | ||
@media: { @media (min-width: 1200) { .selector { padding: 0; }} }; | ||
|
||
@empty: {}; | ||
|
||
//call on top | ||
@ruleset(); | ||
@empty(); | ||
@media(); | ||
|
||
//call from ruleset | ||
.call-with-parentheses { | ||
@empty(); | ||
@one-rule(); | ||
@ruleset(); | ||
@media(); | ||
} | ||
|
||
//call from media | ||
@media screen { | ||
@empty(); | ||
@one-rule(); | ||
@ruleset(); | ||
@media(); | ||
} | ||
|
||
//mixin arguments | ||
.mixin-with-arguments-enclosure { | ||
.mixin(@parameter) { | ||
@parameter(); | ||
} | ||
|
||
.custom-mixin-argument { | ||
.mixin({custom: custom;}); | ||
} | ||
} | ||
|
||
//scope - see caller | ||
.see-caller { | ||
@detached-ruleset: { | ||
caller-variable: @variable; | ||
.mixin(); | ||
}; | ||
|
||
use-place { | ||
@detached-ruleset(); | ||
|
||
//define variable and mixin | ||
@variable: value; | ||
.mixin() { | ||
position: caller; | ||
} | ||
} | ||
} | ||
|
||
//scope - local win | ||
.see-caller { | ||
@detached-ruleset: { | ||
caller-variable: @variable; | ||
.mixin(); | ||
}; | ||
|
||
@variable: declaration; | ||
.mixin() { | ||
variable: declaration; | ||
} | ||
|
||
use-place { | ||
@detached-ruleset(); | ||
|
||
//define variable and mixin | ||
@variable: value; | ||
.mixin() { | ||
position: caller; | ||
} | ||
} | ||
} | ||
//scope - called mixin sees things from detached | ||
.see-caller-caller { | ||
@detached-ruleset: { | ||
@variable: in detached; | ||
.mixin(); | ||
.in-detached() { | ||
sees: me; | ||
} | ||
}; | ||
|
||
use-place { | ||
@detached-ruleset(); | ||
|
||
//define variable and mixin | ||
.mixin() { | ||
position: @variable; | ||
.in-detached(); | ||
} | ||
} | ||
} | ||
|
||
//detached with mixin | ||
@with-mixin-default: { | ||
.mixin(@parameter: default) { | ||
property: @parameter; | ||
} | ||
.default { | ||
.mixin(); | ||
} | ||
.custom { | ||
.mixin(custom); | ||
} | ||
}; | ||
@with-mixin-default(); | ||
|
||
@global-default: global default; | ||
@with-mixin-global-default: { | ||
.mixin(@parameter: @global-default) { | ||
property: @parameter; | ||
} | ||
.default { | ||
.mixin(); | ||
} | ||
.custom { | ||
.mixin(custom); | ||
} | ||
}; | ||
@with-mixin-global-default(); | ||
|
||
@with-mixin-caller-default: { | ||
.mixin(@parameter: @caller-default) { | ||
property: @parameter; | ||
} | ||
.default { | ||
.mixin(); | ||
} | ||
.custom { | ||
.mixin(custom); | ||
} | ||
}; | ||
.caller { | ||
@caller-default: caller; | ||
@with-mixin-caller-default(); | ||
} | ||
//unlock mixin see things defined in his scope first | ||
@with-mixin-unlocking: { | ||
.mixin() { | ||
value: @value; | ||
} | ||
@value: in detached; | ||
}; | ||
.caller { | ||
@value: caller; | ||
@with-mixin-unlocking(); | ||
.mixin(); | ||
} |
11 changes: 11 additions & 0 deletions
11
...st/resources/compile-basic-features/detached-rulesets/detached-rulesets-incompatible.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.mixin(@parameter: {default: default;}) { | ||
@parameter(); | ||
} | ||
|
||
.default-mixin-argument { | ||
.mixin(); | ||
} | ||
|
||
.custom-mixin-argument { | ||
.mixin({custom: custom;}); | ||
} |
71 changes: 71 additions & 0 deletions
71
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-lessjs.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.wrap-selector { | ||
color: black; | ||
one: 1px; | ||
four: magic-frame; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
.wrap-selector { | ||
color: red; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
.wrap-selector { | ||
color: black; | ||
background: white; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
header { | ||
background: blue; | ||
} | ||
@media screen and (min-width: 1200) { | ||
header { | ||
background: red; | ||
} | ||
} | ||
html.lt-ie9 header { | ||
background: red; | ||
} | ||
.wrap-selector { | ||
test: extra-wrap; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
.wrap-selector .wrap-selector { | ||
test: wrapped-twice; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
.wrap-selector { | ||
test-func: 90; | ||
test-arithmetic: 18px; | ||
visible-one: visible; | ||
visible-two: visible; | ||
} | ||
.without-mixins { | ||
b: 1; | ||
} | ||
@media (orientation: portrait) and tv { | ||
.my-selector { | ||
background-color: black; | ||
} | ||
} | ||
@media (orientation: portrait) and widescreen and print and tv { | ||
.triple-wrapped-mq { | ||
triple: true; | ||
} | ||
} | ||
@media (orientation: portrait) and widescreen and tv { | ||
.triple-wrapped-mq { | ||
triple: true; | ||
} | ||
} | ||
@media (orientation: portrait) and tv { | ||
.triple-wrapped-mq { | ||
triple: true; | ||
} | ||
} | ||
.a { | ||
test: test; | ||
} |
Oops, something went wrong.