Skip to content

Commit b91a8f8

Browse files
committed
Fix support for container query utilities with arbitrary values
1 parent f667746 commit b91a8f8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/lib/defaultExtractor.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ function* buildRegExps(context) {
4040
// Utilities
4141
regex.pattern([
4242
// Utility Name / Group Name
43-
/-?(?:\w+)/,
43+
regex.any([
44+
/-?(?:\w+)/,
45+
46+
// This is here to make sure @container supports everything that other utilities do
47+
/@(?:\w+)/,
48+
]),
4449

4550
// Normal/Arbitrary values
4651
regex.optional(

tests/parse-candidate-strings.test.js

+16
Original file line numberDiff line numberDiff line change
@@ -496,5 +496,21 @@ describe.each([
496496
expect(extractions).toContain(value)
497497
}
498498
})
499+
500+
it.each([
501+
['@container', ['@container']],
502+
['@container/sidebar', ['@container/sidebar']],
503+
['@container/[sidebar]', ['@container/[sidebar]']],
504+
['@container-size', ['@container-size']],
505+
['@container-size/sidebar', ['@container-size/sidebar']],
506+
['@container-[size]/sidebar', ['@container-[size]/sidebar']],
507+
['@container-[size]/[sidebar]', ['@container-[size]/[sidebar]']],
508+
])('should support utilities starting with @ (%#)', async (content, expectations) => {
509+
let extractions = defaultExtractor(content)
510+
511+
for (let value of expectations) {
512+
expect(extractions).toContain(value)
513+
}
514+
})
499515
})
500516
})

0 commit comments

Comments
 (0)