Skip to content

Commit 49f6ad2

Browse files
authored
fix: ignore 'initial' keyword (#106)
1 parent 67b5d08 commit 49f6ad2

File tree

6 files changed

+383
-2
lines changed

6 files changed

+383
-2
lines changed

src/__tests__/vendor/tailwind/_tailwind.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function render(
8585
console.log(`Output CSS:\n---\n${output}\n---\n`);
8686
}
8787

88-
const compiled = registerCSS(output, { debug });
88+
const compiled = registerCSS(output, { debug: false });
8989

9090
return Object.assign(
9191
{},
Lines changed: 356 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
import { renderCurrentTest, renderSimple } from "./_tailwind";
2+
3+
describe("Backgrounds - Background Attachment", () => {
4+
test("bg-fixed", async () => {
5+
expect(await renderCurrentTest()).toStrictEqual({
6+
props: {},
7+
warnings: { properties: ["background-attachment"] },
8+
});
9+
});
10+
test("bg-local", async () => {
11+
expect(await renderCurrentTest()).toStrictEqual({
12+
props: {},
13+
warnings: { properties: ["background-attachment"] },
14+
});
15+
});
16+
test("bg-scroll", async () => {
17+
expect(await renderCurrentTest()).toStrictEqual({
18+
props: {},
19+
warnings: { properties: ["background-attachment"] },
20+
});
21+
});
22+
});
23+
24+
describe("Backgrounds - Background Clip", () => {
25+
test("bg-clip-border", async () => {
26+
expect(await renderCurrentTest()).toStrictEqual({
27+
props: {},
28+
warnings: { properties: ["background-clip"] },
29+
});
30+
});
31+
test("bg-clip-padding", async () => {
32+
expect(await renderCurrentTest()).toStrictEqual({
33+
props: {},
34+
warnings: { properties: ["background-clip"] },
35+
});
36+
});
37+
test("bg-clip-content", async () => {
38+
expect(await renderCurrentTest()).toStrictEqual({
39+
props: {},
40+
warnings: { properties: ["background-clip"] },
41+
});
42+
});
43+
test("bg-clip-text", async () => {
44+
expect(await renderCurrentTest()).toStrictEqual({
45+
props: {},
46+
warnings: { properties: ["background-clip"] },
47+
});
48+
});
49+
});
50+
51+
describe("Backgrounds - Background Color", () => {
52+
test("bg-current", async () => {
53+
expect(
54+
await renderSimple({ className: "bg-current text-red-500" }),
55+
).toStrictEqual({
56+
props: {
57+
style: {
58+
color: "#fb2c36",
59+
backgroundColor: "#fb2c36",
60+
},
61+
},
62+
});
63+
});
64+
65+
test("bg-transparent", async () => {
66+
expect(await renderCurrentTest()).toStrictEqual({
67+
props: { style: { backgroundColor: "#0000" } },
68+
});
69+
});
70+
71+
test("bg-white", async () => {
72+
expect(await renderCurrentTest()).toStrictEqual({
73+
props: { style: { backgroundColor: "#fff" } },
74+
});
75+
});
76+
});
77+
78+
describe("Backgrounds - Background Origin", () => {
79+
test("bg-origin-border", async () => {
80+
expect(await renderCurrentTest()).toStrictEqual({
81+
props: {},
82+
warnings: { properties: ["background-origin"] },
83+
});
84+
});
85+
test("bg-origin-padding", async () => {
86+
expect(await renderCurrentTest()).toStrictEqual({
87+
props: {},
88+
warnings: { properties: ["background-origin"] },
89+
});
90+
});
91+
test("bg-origin-content", async () => {
92+
expect(await renderCurrentTest()).toStrictEqual({
93+
props: {},
94+
warnings: { properties: ["background-origin"] },
95+
});
96+
});
97+
});
98+
99+
describe("Backgrounds - Background Position", () => {
100+
test("bg-bottom", async () => {
101+
expect(await renderCurrentTest()).toStrictEqual({
102+
props: {},
103+
warnings: { properties: ["background-position"] },
104+
});
105+
});
106+
test("bg-center", async () => {
107+
expect(await renderCurrentTest()).toStrictEqual({
108+
props: {},
109+
warnings: { properties: ["background-position"] },
110+
});
111+
});
112+
test("bg-left", async () => {
113+
expect(await renderCurrentTest()).toStrictEqual({
114+
props: {},
115+
warnings: { properties: ["background-position"] },
116+
});
117+
});
118+
test("bg-left-bottom", async () => {
119+
expect(await renderCurrentTest()).toStrictEqual({
120+
props: {},
121+
warnings: { properties: ["background-position"] },
122+
});
123+
});
124+
test("bg-left-top", async () => {
125+
expect(await renderCurrentTest()).toStrictEqual({
126+
props: {},
127+
warnings: { properties: ["background-position"] },
128+
});
129+
});
130+
test("bg-right", async () => {
131+
expect(await renderCurrentTest()).toStrictEqual({
132+
props: {},
133+
warnings: { properties: ["background-position"] },
134+
});
135+
});
136+
test("bg-right-bottom", async () => {
137+
expect(await renderCurrentTest()).toStrictEqual({
138+
props: {},
139+
warnings: { properties: ["background-position"] },
140+
});
141+
});
142+
test("bg-right-top", async () => {
143+
expect(await renderCurrentTest()).toStrictEqual({
144+
props: {},
145+
warnings: { properties: ["background-position"] },
146+
});
147+
});
148+
test("bg-top", async () => {
149+
expect(await renderCurrentTest()).toStrictEqual({
150+
props: {},
151+
warnings: { properties: ["background-position"] },
152+
});
153+
});
154+
});
155+
156+
describe("Backgrounds - Background Repeat", () => {
157+
test("bg-repeat", async () => {
158+
expect(await renderCurrentTest()).toStrictEqual({
159+
props: {},
160+
warnings: { properties: ["background-repeat"] },
161+
});
162+
});
163+
});
164+
165+
describe("Backgrounds - Background Size", () => {
166+
test("bg-auto", async () => {
167+
expect(await renderCurrentTest()).toStrictEqual({
168+
props: {},
169+
warnings: { properties: ["background-size"] },
170+
});
171+
});
172+
test("bg-cover", async () => {
173+
expect(await renderCurrentTest()).toStrictEqual({
174+
props: {},
175+
warnings: { properties: ["background-size"] },
176+
});
177+
});
178+
test("bg-contain", async () => {
179+
expect(await renderCurrentTest()).toStrictEqual({
180+
props: {},
181+
warnings: { properties: ["background-size"] },
182+
});
183+
});
184+
});
185+
186+
describe("Backgrounds - Background Image", () => {
187+
test("bg-none", async () => {
188+
expect(
189+
await renderSimple({
190+
className: "bg-none",
191+
}),
192+
).toStrictEqual({
193+
props: {
194+
style: {
195+
experimental_backgroundImage: ["none"],
196+
},
197+
},
198+
});
199+
});
200+
test("bg-gradient-to-t", async () => {
201+
expect(
202+
await renderSimple({
203+
className: "bg-gradient-to-t from-red-500 to-blue-500",
204+
}),
205+
).toStrictEqual({
206+
props: {
207+
style: {
208+
experimental_backgroundImage:
209+
"linear-gradient(to top in oklab, #fb2c36 0%, #2b7fff 100%)",
210+
},
211+
},
212+
warnings: {
213+
values: {
214+
"background-image": ["initial", "initial", "initial"],
215+
},
216+
},
217+
});
218+
});
219+
test("bg-gradient-to-tr", async () => {
220+
expect(
221+
await renderSimple({
222+
className: "bg-gradient-to-tr from-red-500 to-blue-500",
223+
}),
224+
).toStrictEqual({
225+
props: {
226+
style: {
227+
experimental_backgroundImage:
228+
"linear-gradient(to top right in oklab, #fb2c36 0%, #2b7fff 100%)",
229+
},
230+
},
231+
warnings: {
232+
values: {
233+
"background-image": ["initial", "initial", "initial"],
234+
},
235+
},
236+
});
237+
});
238+
test("bg-gradient-to-r", async () => {
239+
expect(
240+
await renderSimple({
241+
className: "bg-gradient-to-r from-red-500 to-blue-500",
242+
}),
243+
).toStrictEqual({
244+
props: {
245+
style: {
246+
experimental_backgroundImage:
247+
"linear-gradient(to right in oklab, #fb2c36 0%, #2b7fff 100%)",
248+
},
249+
},
250+
warnings: {
251+
values: {
252+
"background-image": ["initial", "initial", "initial"],
253+
},
254+
},
255+
});
256+
});
257+
test("bg-gradient-to-br", async () => {
258+
expect(
259+
await renderSimple({
260+
className: "bg-gradient-to-br from-red-500 to-blue-500",
261+
}),
262+
).toStrictEqual({
263+
props: {
264+
style: {
265+
experimental_backgroundImage:
266+
"linear-gradient(to bottom right in oklab, #fb2c36 0%, #2b7fff 100%)",
267+
},
268+
},
269+
warnings: {
270+
values: {
271+
"background-image": ["initial", "initial", "initial"],
272+
},
273+
},
274+
});
275+
});
276+
test("bg-gradient-to-b", async () => {
277+
expect(
278+
await renderSimple({
279+
className: "bg-gradient-to-b from-red-500 to-blue-500",
280+
}),
281+
).toStrictEqual({
282+
props: {
283+
style: {
284+
experimental_backgroundImage:
285+
"linear-gradient(to bottom in oklab, #fb2c36 0%, #2b7fff 100%)",
286+
},
287+
},
288+
warnings: {
289+
values: {
290+
"background-image": ["initial", "initial", "initial"],
291+
},
292+
},
293+
});
294+
});
295+
test("bg-gradient-to-bl", async () => {
296+
expect(
297+
await renderSimple({
298+
className: "bg-gradient-to-bl from-red-500 to-blue-500",
299+
}),
300+
).toStrictEqual({
301+
props: {
302+
style: {
303+
experimental_backgroundImage:
304+
"linear-gradient(to bottom left in oklab, #fb2c36 0%, #2b7fff 100%)",
305+
},
306+
},
307+
warnings: {
308+
values: {
309+
"background-image": ["initial", "initial", "initial"],
310+
},
311+
},
312+
});
313+
});
314+
test("bg-gradient-to-l", async () => {
315+
expect(
316+
await renderSimple({
317+
className: "bg-gradient-to-l from-red-500 to-blue-500",
318+
}),
319+
).toStrictEqual({
320+
props: {
321+
style: {
322+
experimental_backgroundImage:
323+
"linear-gradient(to left in oklab, #fb2c36 0%, #2b7fff 100%)",
324+
},
325+
},
326+
warnings: {
327+
values: {
328+
"background-image": ["initial", "initial", "initial"],
329+
},
330+
},
331+
});
332+
});
333+
test("bg-gradient-to-tl", async () => {
334+
expect(
335+
await renderSimple({
336+
className: "bg-gradient-to-tl from-red-500 to-blue-500",
337+
}),
338+
).toStrictEqual({
339+
props: {
340+
style: {
341+
experimental_backgroundImage:
342+
"linear-gradient(to top left in oklab, #fb2c36 0%, #2b7fff 100%)",
343+
},
344+
},
345+
warnings: {
346+
values: {
347+
"background-image": ["initial", "initial", "initial"],
348+
},
349+
},
350+
});
351+
});
352+
});
353+
354+
describe.skip("Backgrounds - Gradient Color Stops", () => {
355+
// TODO
356+
});

0 commit comments

Comments
 (0)