Skip to content

Handle legacy key behavior in theme-driven suggestions for @utility #17733

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

Merged
merged 4 commits into from
Apr 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
thecrypticace committed Apr 22, 2025
commit 478223e69220687b0d486200f19e8a03df73d94f
16 changes: 15 additions & 1 deletion packages/tailwindcss/src/intellisense.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ test('Theme keys with underscores are suggested with underscores', async () => {
/* This will get suggeted with an underscore */
--spacing-logo_margin: 0.875rem;
}

@utility ex-* {
width: --value(--spacing- *);
}
`

let design = await __unstable__loadDesignSystem(input, {
Expand All @@ -588,15 +592,25 @@ test('Theme keys with underscores are suggested with underscores', async () => {
}),
})

let entries = design.getClassList().filter(([name]) => name.startsWith('p-'))
let entries = design
.getClassList()
.filter(([name]) => name.startsWith('p-') || name.startsWith('ex-'))

expect(entries).toContainEqual(['p-1.5', { modifiers: [] }])
expect(entries).toContainEqual(['p-2.5', { modifiers: [] }])
expect(entries).toContainEqual(['p-logo_margin', { modifiers: [] }])

expect(entries).toContainEqual(['ex-1.5', { modifiers: [] }])
expect(entries).toContainEqual(['ex-2.5', { modifiers: [] }])
expect(entries).toContainEqual(['ex-logo_margin', { modifiers: [] }])

expect(entries).not.toContainEqual(['p-1_5', { modifiers: [] }])
expect(entries).not.toContainEqual(['p-2_5', { modifiers: [] }])
expect(entries).not.toContainEqual(['p-logo.margin', { modifiers: [] }])

expect(entries).not.toContainEqual(['ex-1_5', { modifiers: [] }])
expect(entries).not.toContainEqual(['ex-2_5', { modifiers: [] }])
expect(entries).not.toContainEqual(['ex-logo.margin', { modifiers: [] }])
})

test('shadow utility default suggestions', async () => {
Expand Down