Skip to content

Commit 7462d0a

Browse files
committed
add @variant related source map test
1 parent 5274a9e commit 7462d0a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

packages/tailwindcss/src/source-maps/source-map.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,31 @@ test('@apply generates source maps', async ({ expect }) => {
395395
])
396396
})
397397

398+
test('@variant generates source maps', async ({ expect }) => {
399+
let { sources, annotations } = await run({
400+
input: css`
401+
.foo {
402+
@variant hover {
403+
color: red;
404+
}
405+
406+
@variant focus:disabled, hover:aria-expanded {
407+
color: blue;
408+
}
409+
}
410+
`,
411+
})
412+
413+
expect(sources).toEqual(['input.css'])
414+
415+
expect(annotations).toEqual([
416+
'input.css: 1:0-5 <- 1:0-5',
417+
'input.css: 4:6-16 <- 3:4-14',
418+
'input.css: 9:6-17 <- 7:4-15',
419+
'input.css: 15:8-19 <- 7:4-15',
420+
])
421+
})
422+
398423
test('license comments preserve source locations', async ({ expect }) => {
399424
let { sources, annotations } = await run({
400425
input: `/*! some comment */`,

0 commit comments

Comments
 (0)