tailwindcss/tests/plugins/fontSize.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

124 lines
3.0 KiB
JavaScript

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