mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Run test suite against both engines * make eslint happy * only run `stable` tests on Node 12 * use normal expectation instead of snapshot file When we run the tests only against `stable` (for node 12), then the snapshots exists for the `Oxide` build. They are marked as `obsolete` and will cause the `npm run test` script to fail. Sadly. Inlined them for now, but ideally we make those tests more blackbox-y so that we test that we get source maps and that we can map the sourcemap back to the input files (without looking at the actual annotations). * properly indent inline css Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
109 lines
3.4 KiB
JavaScript
109 lines
3.4 KiB
JavaScript
import { crosscheck, run, html, css, defaults } from '../util/run'
|
|
|
|
crosscheck(({ stable, oxide }) => {
|
|
it('should add the divide styles for divide-y and a default border color', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="divide-y"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
return run('@tailwind base; @tailwind utilities;', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-y-reverse: 0;
|
|
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('should add the divide styles for divide-x and a default border color', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="divide-x"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
return run('@tailwind base; @tailwind utilities;', config).then((result) => {
|
|
stable.expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-x > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-x-reverse: 0;
|
|
border-right-width: calc(1px * var(--tw-divide-x-reverse));
|
|
border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse)));
|
|
}
|
|
`)
|
|
|
|
oxide.expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-x > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-x-reverse: 0;
|
|
border-inline-end-width: calc(1px * var(--tw-divide-x-reverse));
|
|
border-inline-start-width: calc(1px * calc(1 - var(--tw-divide-x-reverse)));
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('should add the divide styles for divide-y-reverse and a default border color', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="divide-y-reverse"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
return run('@tailwind base; @tailwind utilities;', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-y-reverse > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-y-reverse: 1;
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('should add the divide styles for divide-x-reverse and a default border color', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="divide-x-reverse"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
return run('@tailwind base; @tailwind utilities;', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-x-reverse > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-x-reverse: 1;
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
it('should only inject the base styles once if we use divide and border at the same time', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="divide-y border-r"></div>` }],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
return run('@tailwind base; @tailwind utilities;', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
${defaults}
|
|
|
|
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
|
--tw-divide-y-reverse: 0;
|
|
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
}
|
|
|
|
.border-r {
|
|
border-right-width: 1px;
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
})
|