-
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.
Merge branch 'master' of https://github.com/SomMeri/less4j
Conflicts: src/test/resources/minitests/debug1.less
- Loading branch information
Showing
15 changed files
with
502 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/test/java/com/github/sommeri/less4j/compiler/DetachedRulesetsTest.java
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,23 @@ | ||
package com.github.sommeri.less4j.compiler; | ||
|
||
import java.io.File; | ||
import java.util.Collection; | ||
|
||
import org.junit.Ignore; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
@Ignore | ||
public class DetachedRulesetsTest extends BasicFeaturesTest { | ||
|
||
private static final String standardCases = "src/test/resources/compile-basic-features/detached-rulesets/"; | ||
|
||
public DetachedRulesetsTest(File inputFile, File outputFile, File errorList, File mapdataFile, String testName) { | ||
super(inputFile, outputFile, errorList, mapdataFile, testName); | ||
} | ||
|
||
@Parameters(name="Less: {4}") | ||
public static Collection<Object[]> allTestsParameters() { | ||
return createTestFileUtils().loadTestFiles(standardCases); | ||
} | ||
|
||
} |
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(); | ||
} |
1 change: 1 addition & 0 deletions
1
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-errors.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 @@ | ||
TODO |
1 change: 1 addition & 0 deletions
1
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-errors.err
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 @@ | ||
TODO |
36 changes: 36 additions & 0 deletions
36
src/test/resources/compile-basic-features/detached-rulesets/detached-rulesets-errors.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,36 @@ | ||
@a: { | ||
b: 1; | ||
}; | ||
//less.js detached-ruleset-1.less | ||
.call-without-parentheses { | ||
@a; | ||
} | ||
|
||
//less.js detached-ruleset-2.less | ||
.detached-as-property-value { | ||
a: @a(); | ||
} | ||
|
||
//less.js detached-ruleset-3.less | ||
.brings-property-on-top {} | ||
@a(); | ||
|
||
//less.js detached-ruleset-4.less | ||
.warning-for-default(@a: { | ||
b: 1; | ||
}) { | ||
@a(); //warning shall be enough for this one | ||
} | ||
|
||
//less.js detached-ruleset-5.less | ||
.mixin-variable-does-not-exists(@b) { | ||
@a(); | ||
} | ||
.mixin-variable-does-not-exists({color: red;}); | ||
|
||
//less.js detached-ruleset-6.less | ||
.variable-declaration-symbol-missing { | ||
b: { | ||
color: red; | ||
}; | ||
} |
Empty file.
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.