Skip to content

Commit ea62d74

Browse files
test: regression test for @container mixin parameter variable resolution (#4420)
* Initial plan * Initial plan: add regression test for container mixin parameters issue Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> * test: add regression test for container mixin parameters issue (#4420) Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> Co-authored-by: Matthew Dean <matthew-dean@users.noreply.github.com>
1 parent d250d62 commit ea62d74

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

packages/test-data/tests-unit/container/container.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,21 @@
273273
font-size: 75%;
274274
}
275275
}
276+
.mixin-container-test {
277+
color: red;
278+
}
279+
@container name (width < 125px) {
280+
.mixin-container-test {
281+
display: none;
282+
}
283+
}
284+
@container sidebar (width < 500px) {
285+
.sidebar-test {
286+
display: none;
287+
}
288+
}
289+
@container header (width < 800px) {
290+
.header-test {
291+
display: none;
292+
}
293+
}

packages/test-data/tests-unit/container/container.less

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,27 @@
326326
font-size: 75%;
327327
}
328328
}
329+
330+
// Regression test: mixin with variable container name and variable query condition
331+
// Issue: mixins with parameters using @container @name (condition < @var) failed
332+
// with "variable @bp is undefined" error in older versions
333+
@issue-width: 125px;
334+
335+
.container-query-mixin(@container-name; @bp) {
336+
@container @container-name (width < @bp) {
337+
display: none;
338+
}
339+
}
340+
341+
.mixin-container-test {
342+
.container-query-mixin(name, @issue-width);
343+
color: red;
344+
}
345+
346+
// Verify multiple calls with different params produce correct output
347+
.sidebar-test {
348+
.container-query-mixin(sidebar, 500px);
349+
}
350+
.header-test {
351+
.container-query-mixin(header, 800px);
352+
}

0 commit comments

Comments
 (0)