Skip to content

Commit 3a915a2

Browse files
committed
test: add group-modifier tests
1 parent 7123b0d commit 3a915a2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/twcss-to-sass.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,35 @@ test('convert to sass with comments class names', () => {
9898

9999
expect(converterResult?.sass).toBe(sassOutput)
100100
})
101+
102+
test('convert to sass with group-modifier', () => {
103+
const htmlCotnent = `<div class="inline relative group h-48">
104+
<div class=" bottom-0 px-3 space-x-2 group-hover:opacity-100 group-hover:bg-gradient-to-t">
105+
Test
106+
</div>
107+
</div>`
108+
109+
const sassOutput = `/* div -> 1 */
110+
.class-div-1 {
111+
@apply inline relative h-48;
112+
113+
/* #region Group modifier: hover */
114+
115+
&:hover {
116+
.class-div-1 {
117+
@apply opacity-100 bg-gradient-to-t;
118+
}
119+
}
120+
121+
/* #endregion */
122+
123+
/* div -> 2 */
124+
.class-div-2 {
125+
@apply bottom-0 px-3 space-x-2;
126+
}
127+
}`
128+
129+
const converterResult = convertToSass(htmlCotnent)
130+
131+
expect(converterResult?.sass).toBe(sassOutput)
132+
})

0 commit comments

Comments
 (0)