tailwindcss/tests/import-processing.test.js
Jordan Pittman fb1743b4b0
Restore old behavior for class dark mode, add new selector and variant options for dark mode (#12717)
* Add dark mode variant option

* Tweak warning messages

* Add legacy dark mode option

* wip

* Use `class` for legacy behavior, `selector` for new behavior

* Add simplified failing apply/where test case

* Switch to `where` list, apply changes to `dir` variants

* Don’t let `:where`, `:is:`, or `:has` be attached to pseudo elements

* Updating tests...

* Finish updating tests

* Remove `variant` dark mode strategy

* Update types

* Update comments

* Update changelog

* Revert "Remove `variant` dark mode strategy"

This reverts commit 185250438c.

* Add variant back to types

* wip

* Update comments

* Update tests

* Rename variable

* Update changelog

* Update changelog

* Update changelog

* Fix CS

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-01-05 14:39:34 -05:00

76 lines
1.6 KiB
JavaScript

import { html, css, run } from './util/run'
describe('import processing', () => {
it('should be possible to import another css file', async () => {
let config = {
darkMode: 'selector',
content: [
{
raw: html`<div class="underline" />`,
},
],
corePlugins: { preflight: false },
}
let input = css`
@import './import-processing-a.css';
`
let result = await run(input, config)
expect(result.css).toMatchFormattedCss(css`
.underline {
text-decoration-line: underline;
}
`)
})
it('should be possible to import another css file after @tailwind directive', async () => {
let config = {
darkMode: 'selector',
content: [
{
raw: html`<div class="foo underline" />`,
},
],
corePlugins: { preflight: false },
}
let input = css`
@tailwind utilities;
@import './import-processing-b.css';
`
let result = await run(input, config)
expect(result.css).toMatchFormattedCss(css`
.underline {
text-decoration-line: underline;
}
.foo {
color: red;
}
`)
})
it('should be possible to add @config before @import statements', async () => {
let input = css`
@config "./import-processing-c.js";
@import './import-processing-c.css';
`
let result = await run(input)
expect(result.css).toMatchFormattedCss(css`
.underline {
text-decoration-line: underline;
}
.foo {
color: red;
}
`)
})
})