Skip to content

Commit d858683

Browse files
test(css): cover an imported @value used as a selector
The only line of the new selector path with no case: an imported value keeps its plain textual substitution, since the defining module owns the scoped name. Brings the patch to full line coverage.
1 parent d1ade26 commit d858683

5 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎test/configCases/css/css-modules-value-at-rule-prelude/__snapshots__/ConfigCacheTest.snap‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exports[`ConfigCacheTestCases css css-modules-value-at-rule-prelude exported tes
77
88
99
10+
1011
@keyframes value-at-rule-prelude-values_module_css-importedKeyframes {
1112
from { opacity: 0; }
1213
}
@@ -181,6 +182,12 @@ article {
181182
color: gray;
182183
}
183184
185+
186+
187+
.importedCls {
188+
color: silver;
189+
}
190+
184191
/*!***********************************!*\\\\
185192
!*** css ./no-scoping.module.css ***!
186193
\\\\***********************************/

‎test/configCases/css/css-modules-value-at-rule-prelude/__snapshots__/ConfigTest.snap‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exports[`ConfigTestCases css css-modules-value-at-rule-prelude exported tests sh
77
88
99
10+
1011
@keyframes value-at-rule-prelude-values_module_css-importedKeyframes {
1112
from { opacity: 0; }
1213
}
@@ -181,6 +182,12 @@ article {
181182
color: gray;
182183
}
183184
185+
186+
187+
.importedCls {
188+
color: silver;
189+
}
190+
184191
/*!***********************************!*\\\\
185192
!*** css ./no-scoping.module.css ***!
186193
\\\\***********************************/

‎test/configCases/css/css-modules-value-at-rule-prelude/index.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ it("should substitute a @value naming a richer selector verbatim", () => {
199199
expect(css).toMatch(/\.outer \.inner \{\s+color: gray;/);
200200
});
201201

202+
it("should substitute an imported @value used as a selector verbatim", () => {
203+
// The defining module owns the scoped name, so an imported value stays a
204+
// plain textual substitution rather than being localized here.
205+
expect(css).toMatch(/\.importedCls \{\s+color: silver;/);
206+
expect(css).not.toMatch(/_css-importedCls/);
207+
});
208+
202209
it("should keep substituting a @value used as a whole @media query", () => {
203210
expect(css).toMatch(/@media \(max-width: 599px\) \{/);
204211
});

‎test/configCases/css/css-modules-value-at-rule-prelude/style.module.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,9 @@ typeSelValue {
164164
richSelValue {
165165
color: gray;
166166
}
167+
168+
@value importedSelValue from "./values.module.css";
169+
170+
importedSelValue {
171+
color: silver;
172+
}

‎test/configCases/css/css-modules-value-at-rule-prelude/values.module.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@value importedAnimName: importedAnim;
22
@value importedCounterName: importedCounter;
3+
@value importedSelValue: .importedCls;
34

45
@keyframes importedKeyframes {
56
from { opacity: 0; }

0 commit comments

Comments
 (0)