Skip to content

Commit 0d3574d

Browse files
committed
Add tests for decimal and negative values in utilities
1 parent c1d034f commit 0d3574d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

index.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,44 @@ test('variants can be customized', () => {
159159
.then((result) => expect(result.css).toMatchCss(expectedCss))
160160
})
161161

162+
test('utilities can use decimal values', () => {
163+
const testConfig = {
164+
...commonConfig,
165+
theme: {
166+
textStrokeWidth: { '0.5': '0.5px' },
167+
},
168+
safelist: [],
169+
content: [
170+
{ raw: String.raw`<div class="text-stroke-0.5"></div>` },
171+
],
172+
}
173+
const expectedCss = `
174+
.text-stroke-0\\.5 { -webkit-text-stroke-width: 0.5px }
175+
`
176+
177+
return postcss(tailwind(testConfig)).process('@tailwind utilities;', { from: undefined })
178+
.then((result) => expect(result.css).toMatchCss(expectedCss))
179+
})
180+
181+
test('utilities can use negative values', () => {
182+
const testConfig = {
183+
...commonConfig,
184+
theme: {
185+
textStrokeWidth: { '-4': '-4px' },
186+
},
187+
safelist: [],
188+
content: [
189+
{ raw: String.raw`<div class="-text-stroke-4"></div>` },
190+
],
191+
}
192+
const expectedCss = `
193+
.-text-stroke-4 { -webkit-text-stroke-width: -4px }
194+
`
195+
196+
return postcss(tailwind(testConfig)).process('@tailwind utilities;', { from: undefined })
197+
.then((result) => expect(result.css).toMatchCss(expectedCss))
198+
})
199+
162200
test('utilities accept arbitrary values', () => {
163201
const testConfig = {
164202
...commonConfig,

0 commit comments

Comments
 (0)