tailwindcss/tests/plugins/variants/darkVariants.test.js
Robin Malfait dba5043591
Ensure all built-in plugins have tests (#11618)
* move `preflight` tests to `plugins` test folder

* move `container` tests to `plugins` test folder

* add a test that ensures that all built-in plugins have tests

This is based on a few assumptions:

1. All plugins exist in the `corePlugins.js` file and are exported as
   `corePlugins`
2. Each exported plugin in that object has a file with a corresponding
   name in the current (`tests/plugins/`) folder

* add dedicated plugin tests in the `plugins` folder

* add a test that ensures that all built-in variant plugins have tests

This is based on a few assumptions:

1. All variant plugins exist in the `corePlugins.js` file and are
   exported as `variantPlugins`
2. Each exported plugin in that object has a file with a corresponding
   name in the current (`tests/plugins/variants/`) folder

* add dedicated variant plugin tests in the `plugins/variants` folder

* cleanup basic usage test

* move existing animation tests to animation plugin tests

* move `apply-important-selector` tests to more appropriate location
2023-07-24 11:41:52 +02:00

28 lines
621 B
JavaScript

import { css, quickVariantPluginTest } from '../../util/run'
// Default media dark mode
quickVariantPluginTest('darkVariants').toMatchFormattedCss(css`
@media (prefers-color-scheme: dark) {
.dark\:flex {
display: flex;
}
}
`)
// Class dark mode
quickVariantPluginTest('darkVariants', {
darkMode: 'class',
}).toMatchFormattedCss(css`
:is(.dark .dark\:flex) {
display: flex;
}
`)
// Class dark mode with custom class name
quickVariantPluginTest('darkVariants', {
darkMode: ['class', '.my-dark-mode'],
}).toMatchFormattedCss(css`
:is(.my-dark-mode .dark\:flex) {
display: flex;
}
`)