Skip to content

Commit

Permalink
Tests and parser fixes for namespace values in MQ and mixin args (#3254)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean authored Jul 3, 2018
1 parent 29468bf commit 39ef69c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ var Parser = function Parser(context, imports, fileInfo) {
.push({ variadic: true });
break;
}
arg = entities.variable() || entities.property() || entities.literal() || entities.keyword();
arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true);
}

if (!arg) {
Expand Down Expand Up @@ -1642,7 +1642,7 @@ var Parser = function Parser(context, imports, fileInfo) {
var entities = this.entities, nodes = [], e, p;
parserInput.save();
do {
e = entities.keyword() || entities.variable();
e = entities.keyword() || entities.variable() || entities.mixinLookup();
if (e) {
nodes.push(e);
} else if (parserInput.$char('(')) {
Expand Down Expand Up @@ -1676,7 +1676,7 @@ var Parser = function Parser(context, imports, fileInfo) {
features.push(e);
if (!parserInput.$char(',')) { break; }
} else {
e = entities.variable();
e = entities.variable() || entities.mixinLookup();
if (e) {
features.push(e);
if (!parserInput.$char(',')) { break; }
Expand Down
3 changes: 3 additions & 0 deletions test/css/edge/namespacing-2.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
.foo {
width: 800px;
}
.lunch {
treat: ice cream;
}
5 changes: 5 additions & 0 deletions test/css/edge/namespacing-media.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media not all and (min-width: 480px) {
.selector {
prop: val;
}
}
10 changes: 10 additions & 0 deletions test/less/edge/namespacing-2.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@

.foo {
width: #library.sizes[@width];
}

.foods() {
@dessert: ice cream;
}

@key-to-lookup: dessert;

.lunch {
treat: .foods[@@key-to-lookup];
}
26 changes: 26 additions & 0 deletions test/less/edge/namespacing-media.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ns {
.sizes() {
@small: 600px;
}
.breakpoint(@size) {
@val: #ns.sizes[@@size];
@min: (min-width: @val);
@max: not all and @min;
}
}

#ns {
.sizes() {
@small: 480px;
}
}

.valToGet() {
keyword: small;
}

@media #ns.breakpoint(.valToGet[keyword])[@max] {
.selector {
prop: val;
}
}

0 comments on commit 39ef69c

Please sign in to comment.