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`
91 lines
2.1 KiB
JavaScript
91 lines
2.1 KiB
JavaScript
import { run, html, css } from '../util/run'
|
|
|
|
test('font-size utilities can include a default line-height', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="text-md text-sm text-lg"></div>` }],
|
|
theme: {
|
|
fontSize: {
|
|
sm: '12px',
|
|
md: ['16px', '24px'],
|
|
lg: ['20px', '28px'],
|
|
},
|
|
},
|
|
}
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
.text-md {
|
|
font-size: 16px;
|
|
line-height: 24px;
|
|
}
|
|
.text-sm {
|
|
font-size: 12px;
|
|
}
|
|
.text-lg {
|
|
font-size: 20px;
|
|
line-height: 28px;
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
test('font-size utilities can include a default letter-spacing', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="text-md text-sm text-lg"></div>` }],
|
|
theme: {
|
|
fontSize: {
|
|
sm: '12px',
|
|
md: ['16px', { letterSpacing: '-0.01em' }],
|
|
lg: ['20px', { letterSpacing: '-0.02em' }],
|
|
},
|
|
},
|
|
}
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
.text-md {
|
|
font-size: 16px;
|
|
letter-spacing: -0.01em;
|
|
}
|
|
.text-sm {
|
|
font-size: 12px;
|
|
}
|
|
.text-lg {
|
|
font-size: 20px;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
`)
|
|
})
|
|
})
|
|
|
|
test('font-size utilities can include a default line-height and letter-spacing', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="text-md text-sm text-lg"></div>` }],
|
|
theme: {
|
|
fontSize: {
|
|
sm: '12px',
|
|
md: ['16px', { lineHeight: '24px', letterSpacing: '-0.01em' }],
|
|
lg: ['20px', { lineHeight: '28px', letterSpacing: '-0.02em' }],
|
|
},
|
|
},
|
|
}
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
expect(result.css).toMatchCss(css`
|
|
.text-md {
|
|
font-size: 16px;
|
|
line-height: 24px;
|
|
letter-spacing: -0.01em;
|
|
}
|
|
.text-sm {
|
|
font-size: 12px;
|
|
}
|
|
.text-lg {
|
|
font-size: 20px;
|
|
line-height: 28px;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
`)
|
|
})
|
|
})
|