Skip to content

Commit

Permalink
Fix support for container query utilities with arbitrary values (#12534)
Browse files Browse the repository at this point in the history
* Fix support for container query utilities with arbitrary values

* Update changelog
  • Loading branch information
thecrypticace authored Dec 5, 2023
1 parent f667746 commit 7385373
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix support for container query utilities with arbitrary values ([#12534](https://github.com/tailwindlabs/tailwindcss/pull/12534))

### Added

- Add `svh`, `lvh`, and `dvh` values to default `height`/`min-height`/`max-height` theme ([#11317](https://github.com/tailwindlabs/tailwindcss/pull/11317))
Expand Down
7 changes: 6 additions & 1 deletion src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function* buildRegExps(context) {
// Utilities
regex.pattern([
// Utility Name / Group Name
/-?(?:\w+)/,
regex.any([
/-?(?:\w+)/,

// This is here to make sure @container supports everything that other utilities do
/@(?:\w+)/,
]),

// Normal/Arbitrary values
regex.optional(
Expand Down
16 changes: 16 additions & 0 deletions tests/parse-candidate-strings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,5 +496,21 @@ describe.each([
expect(extractions).toContain(value)
}
})

it.each([
['@container', ['@container']],
['@container/sidebar', ['@container/sidebar']],
['@container/[sidebar]', ['@container/[sidebar]']],
['@container-size', ['@container-size']],
['@container-size/sidebar', ['@container-size/sidebar']],
['@container-[size]/sidebar', ['@container-[size]/sidebar']],
['@container-[size]/[sidebar]', ['@container-[size]/[sidebar]']],
])('should support utilities starting with @ (%#)', async (content, expectations) => {
let extractions = defaultExtractor(content)

for (let value of expectations) {
expect(extractions).toContain(value)
}
})
})
})

0 comments on commit 7385373

Please sign in to comment.