Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SomMeri/less4j
Browse files Browse the repository at this point in the history
Conflicts:
	src/test/resources/minitests/debug1.less
  • Loading branch information
meri committed Apr 11, 2014
2 parents a9e8009 + fa3ffeb commit 8c015b8
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 1 deletion.
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);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
selector {
property: 2;
}
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();
}
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;
}
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();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
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;
};
}
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;});
}
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;
}
Loading

0 comments on commit 8c015b8

Please sign in to comment.