Skip to content

Conversation

thecrypticace
Copy link
Contributor

Given the following plugin:

matchVariant('foo', (value) => ':is(' + value + ')', {
  values: {
    DEFAULT: 'default',
    a: 'a',
  }
})

We wouldn't suggest foo: as a variant even though it works. This is because we were suggesting the arbitrary foo-[]: or the default variant instead of both if a variant supported arbitrary values in v4.

This PR fixes the above and now both will be suggested.

@thecrypticace thecrypticace changed the title Suggest default variants when they also support arbitrary values Suggest default variant values when they also support arbitrary values Aug 27, 2025
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question, but looks good otherwise.

Comment on lines +1130 to +1132
// TODO: This test requires Tailwind CSS v4.1.13
// let item2 = items.find((item) => item.label.startsWith('foo-a:'))
// expect(item2?.detail).toEqual(':is(a)')
Copy link
Member

@RobinMalfait RobinMalfait Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming these tests run against multiple versions?

Can we check the version we are currently running, and enable these tests conditionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do not… currently. At least not exactly. Each test can define which version it runs against by adding a package.json.

I left these in b/c I want to enable them once we tag a patch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I misunderstood. I had a brainfart and thought it was about v3 vs v4 😅

Yeah that makes sense to enable them once v4.1.13 is released 👍

@thecrypticace thecrypticace merged commit 1e2d55c into main Aug 27, 2025
12 checks passed
@thecrypticace thecrypticace deleted the fix/variant-defaults-and-arbitrary branch August 27, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants