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:
Jordan Pittman 2022-02-15 13:44:19 -05:00 • committed by GitHub
parent db475be6dd
commit be5d5c9e66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 5 deletions

View file

@ -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;
}
`)
})
})