mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* add prettier-plugin-tailwindcss This will use the prettier plugin in our tests as well, yay consistency! * ensure that both `group` and `peer` can't be used in `@apply` This was only configured for `group` * expose `sortClassList` on the context This function will be used by the `prettier-plugin-tailwindcss` plugin, this way the sorting happens within Tailwind CSS itself adn the `prettier-plugin-tailwindcss` plugin doesn't have to use internal / private APIs. The signature looks like this: ```ts function sortClassList(classes: string[]): string[] ``` E.g.: ```js let sortedClasses = context.sortClassList(['p-1', 'm-1', 'container']) ``` * update changelog * add sort test for utilities with the important modifier e.g.: `!p-4`
45 lines
1008 B
JavaScript
45 lines
1008 B
JavaScript
import { run, html, css } from './util/run'
|
|
|
|
test('basic parallel variants', async () => {
|
|
let config = {
|
|
content: [
|
|
{
|
|
raw: html`<div
|
|
class="hover:test:font-black test:font-bold test:font-medium font-normal"
|
|
></div>`,
|
|
},
|
|
],
|
|
plugins: [
|
|
function test({ addVariant }) {
|
|
addVariant('test', ['& *::test', '&::test'])
|
|
},
|
|
],
|
|
}
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
.font-normal {
|
|
font-weight: 400;
|
|
}
|
|
.test\:font-bold *::test {
|
|
font-weight: 700;
|
|
}
|
|
.test\:font-medium *::test {
|
|
font-weight: 500;
|
|
}
|
|
.hover\:test\:font-black *:hover::test {
|
|
font-weight: 900;
|
|
}
|
|
.test\:font-bold::test {
|
|
font-weight: 700;
|
|
}
|
|
.test\:font-medium::test {
|
|
font-weight: 500;
|
|
}
|
|
.hover\:test\:font-black:hover::test {
|
|
font-weight: 900;
|
|
}
|
|
`)
|
|
})
|
|
})
|