mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
82 lines
1.3 KiB
JavaScript
82 lines
1.3 KiB
JavaScript
import { run, html, css, defaults } from './util/run'
|
|
|
|
it('should generate the partial selector, if only a partial is used (base layer)', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind base;
|
|
|
|
@layer base {
|
|
:root {
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* --- */
|
|
|
|
:root,
|
|
.a {
|
|
color: black;
|
|
}
|
|
}
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
return expect(result.css).toMatchFormattedCss(css`
|
|
:root {
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* --- */
|
|
|
|
:root,
|
|
.a {
|
|
color: black;
|
|
}
|
|
|
|
${defaults}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('should generate the partial selector, if only a partial is used (utilities layer)', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="a"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind utilities;
|
|
|
|
@layer utilities {
|
|
:root {
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* --- */
|
|
|
|
:root,
|
|
.a {
|
|
color: black;
|
|
}
|
|
}
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
return expect(result.css).toMatchFormattedCss(css`
|
|
:root {
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* --- */
|
|
|
|
:root,
|
|
.a {
|
|
color: black;
|
|
}
|
|
`)
|
|
})
|
|
})
|