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

Properly exit calc mode after use #3493

Merged
merged 1 commit into from Apr 28, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/less/contexts.js
Expand Up @@ -84,7 +84,7 @@ contexts.Eval = class {

exitCalc() {
this.calcStack.pop();
if (!this.calcStack) {
if (!this.calcStack.length) {
this.inCalc = false;
}
}
Expand Down
9 changes: 9 additions & 0 deletions test/css/calc.css
Expand Up @@ -17,3 +17,12 @@
.c {
height: calc(100% - ((10px * 3) + (10px * 2)));
}
.correctly-exit-calc-mode h2 {
width: 10px;
}
.correctly-exit-calc-mode div {
width: calc(100px * 2);
}
.correctly-exit-calc-mode h1 {
color: white;
}
18 changes: 17 additions & 1 deletion test/less/calc.less
Expand Up @@ -27,4 +27,20 @@
.c {
@v: 10px;
height: calc(100% - ((@v * 3) + (@v * 2)));
}
}

.correctly-exit-calc-mode {
@a: 10;
h2 { width: unit(@a, px); }

div { width: calc(100px * 2); }

.mk-map() {
text: white;
background: black;
}

@p: .mk-map();

h1 { color: @p[text]; }
}
2 changes: 1 addition & 1 deletion test/sourcemaps/custom-props.json
@@ -1 +1 @@
{"version":3,"sources":["testweb/sourcemaps/custom-props.less"],"names":[],"mappings":"AAEA;EACC,uBAHO,UAGP;EACA,OAAO,eAAP;EACA,gCAAA","file":"sourcemaps/custom-props.css"}
{"version":3,"sources":["testweb/sourcemaps/custom-props.less"],"names":[],"mappings":"AAEA;EACC,uBAHO,UAGP;EACA,OAAO,eAAP;EACA,sBALO,UAKP","file":"sourcemaps/custom-props.css"}