Skip to content

Commit b7d2c8f

Browse files
committed
Add test for lit-html syntax
1 parent a44f58f commit b7d2c8f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/syntax-lit-html.test.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { run } from './util/run'
2+
3+
let css = String.raw
4+
5+
test('it detects classes in lit-html templates', () => {
6+
let config = {
7+
content: [
8+
{
9+
raw: `html\`<button class="bg-blue-400 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded">\${data.title}</button>\`;`,
10+
},
11+
],
12+
corePlugins: { preflight: false },
13+
theme: {},
14+
plugins: [],
15+
}
16+
17+
return run('@tailwind utilities', config).then((result) => {
18+
expect(result.css).toMatchCss(css`
19+
.rounded {
20+
border-radius: 0.25rem;
21+
}
22+
.bg-blue-400 {
23+
--tw-bg-opacity: 1;
24+
background-color: rgb(96 165 250 / var(--tw-bg-opacity));
25+
}
26+
.py-2 {
27+
padding-top: 0.5rem;
28+
padding-bottom: 0.5rem;
29+
}
30+
.px-4 {
31+
padding-left: 1rem;
32+
padding-right: 1rem;
33+
}
34+
.font-bold {
35+
font-weight: 700;
36+
}
37+
.text-white {
38+
--tw-text-opacity: 1;
39+
color: rgb(255 255 255 / var(--tw-text-opacity));
40+
}
41+
.hover\:bg-blue-600:hover {
42+
--tw-bg-opacity: 1;
43+
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
44+
}
45+
`)
46+
})
47+
})

0 commit comments

Comments
 (0)