mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Ensure nested selectors are not modified when using group-* and peer-*
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
This commit is contained in:
parent
23e6d433a2
commit
cf846a5ff6
@ -1811,4 +1811,53 @@ describe('@variant', () => {
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
test('combining multiple complex variants', () => {
|
||||
let compiled = compile(css`
|
||||
@variant one {
|
||||
&.foo-1 {
|
||||
&.bar-1 {
|
||||
@slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@variant two {
|
||||
&.foo-2 {
|
||||
&.bar-2 {
|
||||
@slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
@tailwind utilities;
|
||||
}
|
||||
`).build([
|
||||
'group-one:two:underline',
|
||||
'one:group-two:underline',
|
||||
'peer-one:two:underline',
|
||||
'one:peer-two:underline',
|
||||
])
|
||||
|
||||
expect(optimizeCss(compiled).trim()).toMatchInlineSnapshot(`
|
||||
"@layer utilities {
|
||||
.one\\:group-two\\:underline.foo-1.bar-1:is(:where(.group).foo-2 *):is(:where(.group).bar-2 *) {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
|
||||
.one\\:peer-two\\:underline.foo-1.bar-1:is(:where(.peer).foo-2 ~ *):is(:where(.peer).bar-2 ~ *) {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
|
||||
.group-one\\:two\\:underline:is(:where(.group).foo-1 *):is(:where(.group).bar-1 *).foo-2.bar-2 {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
|
||||
.peer-one\\:two\\:underline:is(:where(.peer).foo-1 ~ *):is(:where(.peer).bar-1 ~ *).foo-2.bar-2 {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
}"
|
||||
`)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user