Skip to content

Commit 98af0b0

Browse files
committed
fix types
1 parent 3d96209 commit 98af0b0

12 files changed

Lines changed: 2012 additions & 24 deletions

test/api.test.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { test, expect } from 'vitest';
2+
import { format } from '../src/lib/index.js';
3+
test('empty input', () => {
4+
let actual = format(``);
5+
let expected = ``;
6+
expect(actual).toEqual(expected);
7+
});
8+
test('handles invalid input', () => {
9+
let actual = format(`;`);
10+
let expected = ``;
11+
expect(actual).toEqual(expected);
12+
});
13+
test('Vadim Makeevs example works', () => {
14+
let actual = format(`
15+
@layer what {
16+
@container (width > 0) {
17+
ul:has(:nth-child(1 of li)) {
18+
@media (height > 0) {
19+
&:hover {
20+
--is: this;
21+
}
22+
}
23+
}
24+
}
25+
}
26+
`);
27+
let expected = `@layer what {
28+
@container (width > 0) {
29+
ul:has(:nth-child(1 of li)) {
30+
@media (height > 0) {
31+
&:hover {
32+
--is: this;
33+
}
34+
}
35+
}
36+
}
37+
}`;
38+
expect(actual).toEqual(expected);
39+
});
40+
test('minified Vadims example', () => {
41+
let actual = format(`@layer what{@container (width>0){@media (min-height:.001px){ul:has(:nth-child(1 of li)):hover{--is:this}}}}`);
42+
let expected = `@layer what {
43+
@container (width > 0) {
44+
@media (min-height: .001px) {
45+
ul:has(:nth-child(1 of li)):hover {
46+
--is: this;
47+
}
48+
}
49+
}
50+
}`;
51+
expect(actual).toEqual(expected);
52+
});

0 commit comments

Comments
 (0)