tailwindcss/tests/plugins/divide.test.js
Robin Malfait cb46ebdf22
Prepare for the v3.2.5 release (#10531)
* Revert "add caption-side utilities (#10470)"

This reverts commit f395cc4ae5c90eab90a722f42c7fda6ba8ece94e.

* Revert "Add support for configuring default `font-variation-settings` for a `font-family` (#10515)"

This reverts commit 8bd2846b5b906904a49e9ffec9c317e560f2eaa6.

* Revert "feat: add hyphens (#10071)"

This reverts commit f58a43fd75e8344b4c2cd0d34fa7b563b1f3ef3a.

* Revert "Add logical properties support for inline direction"

* Revert "Add `delay-0` and `duration-0` by default"

* Revert "Support using variables as arbitrary values without `var()`"

* Revert "Add `line-height` modifier support to `font-size` utilities"
2023-02-08 15:53:00 +01:00

103 lines
3.3 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-right-width: calc(1px * var(--tw-divide-x-reverse));
border-left-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;
}
`)
})
})
})