mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Remove remnants of the user layer It hasn’t been used in a while * Rewrite sort offset generation * wip * wip wip * Handle parasite utilities * wip * wip * Make parallel variants sorting more resillient It’s not perfect but it’s close * fix * remove todo it adds a new bit so it can’t * Simplify getClassOrder usage * Simplify oops oops * Add parasite utility for `dark` dark mode class name * Cleanup * Cleanup * Simplify * format files * Fix prettier plugin to use git build of Tailwind CSS Symlink and build instead of adding a recursive dev dependency It breaks node < 16 * Fix prettier error * wip * fix test * Update changelog Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
75 lines
1.8 KiB
JavaScript
75 lines
1.8 KiB
JavaScript
import { run, html, css, defaults } from './util/run'
|
|
|
|
it('should be possible to use contrast-more and contrast-less variants', () => {
|
|
let config = {
|
|
content: [
|
|
{ raw: html`<div class="bg-white contrast-more:bg-pink-500 contrast-less:bg-black"></div>` },
|
|
],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind base;
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
${defaults}
|
|
|
|
.bg-white {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
}
|
|
|
|
@media (prefers-contrast: more) {
|
|
.contrast-more\:bg-pink-500 {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(236 72 153 / var(--tw-bg-opacity));
|
|
}
|
|
}
|
|
|
|
@media (prefers-contrast: less) {
|
|
.contrast-less\:bg-black {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
|
|
}
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('dark mode should appear after the contrast variants', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="contrast-more:bg-black dark:bg-white"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind base;
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
${defaults}
|
|
|
|
@media (prefers-contrast: more) {
|
|
.contrast-more\:bg-black {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
|
|
}
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
.dark\:bg-white {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
}
|
|
}
|
|
`)
|
|
})
|
|
})
|