Fix wildcard duplication issue (#7478)
This would be better as a symbol but the stringy-ness of class candidates is fairly well baked into assumptions across the codebase. Using `new String` with a well placed check seems to solve the problem.
This commit is contained in:
parent
db475be6dd
commit
be5d5c9e66
6 changed files with 73 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import { html, run, css } from './util/run'
|
||||
import { html, run, css, defaults } from './util/run'
|
||||
|
||||
test('basic usage', () => {
|
||||
let config = {
|
||||
|
|
@ -188,3 +188,64 @@ it('can scan extremely long classes without crashing', () => {
|
|||
expect(result.css).toMatchFormattedCss(css``)
|
||||
})
|
||||
})
|
||||
|
||||
it('does not produce duplicate output when seeing variants preceding a wildcard (*)', () => {
|
||||
let config = {
|
||||
content: [{ raw: html`underline focus:*` }],
|
||||
corePlugins: { preflight: false },
|
||||
}
|
||||
|
||||
let input = css`
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
* {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.combined,
|
||||
* {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.combined,
|
||||
* {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
return run(input, config).then((result) => {
|
||||
expect(result.css).toMatchFormattedCss(css`
|
||||
* {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.combined,
|
||||
* {
|
||||
color: red;
|
||||
}
|
||||
|
||||
${defaults}
|
||||
|
||||
.underline {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
|
||||
* {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.combined,
|
||||
* {
|
||||
text-align: center;
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue