@@ -325,12 +325,6 @@ describe('@apply', () => {
325
325
}
326
326
}
327
327
328
- @keyframes spin {
329
- to {
330
- transform: rotate(360deg);
331
- }
332
- }
333
-
334
328
@property --tw-translate-x {
335
329
syntax: "*";
336
330
inherits: false;
@@ -347,6 +341,12 @@ describe('@apply', () => {
347
341
syntax: "*";
348
342
inherits: false;
349
343
initial-value: 0;
344
+ }
345
+
346
+ @keyframes spin {
347
+ to {
348
+ transform: rotate(360deg);
349
+ }
350
350
}"
351
351
` )
352
352
} )
@@ -1155,6 +1155,12 @@ describe('Parsing theme values from CSS', () => {
1155
1155
1156
1156
.accent-red {
1157
1157
accent-color: var(--color-red);
1158
+ }
1159
+
1160
+ @keyframes foo {
1161
+ to {
1162
+ opacity: 1;
1163
+ }
1158
1164
}"
1159
1165
` )
1160
1166
} )
@@ -1241,6 +1247,12 @@ describe('Parsing theme values from CSS', () => {
1241
1247
1242
1248
.accent-green {
1243
1249
accent-color: var(--color-green);
1250
+ }
1251
+
1252
+ @keyframes spin {
1253
+ to {
1254
+ transform: rotate(360deg);
1255
+ }
1244
1256
}"
1245
1257
` )
1246
1258
} )
@@ -1288,6 +1300,12 @@ describe('Parsing theme values from CSS', () => {
1288
1300
1289
1301
.accent-green {
1290
1302
accent-color: var(--color-green);
1303
+ }
1304
+
1305
+ @keyframes spin {
1306
+ to {
1307
+ transform: rotate(360deg);
1308
+ }
1291
1309
}"
1292
1310
` )
1293
1311
} )
@@ -1563,6 +1581,12 @@ describe('Parsing theme values from CSS', () => {
1563
1581
animation: var(--animate-foobar);
1564
1582
}
1565
1583
1584
+ @keyframes foo {
1585
+ to {
1586
+ opacity: 1;
1587
+ }
1588
+ }
1589
+
1566
1590
@keyframes foobar {
1567
1591
to {
1568
1592
opacity: 0;
@@ -1609,6 +1633,12 @@ describe('Parsing theme values from CSS', () => {
1609
1633
to {
1610
1634
opacity: 1;
1611
1635
}
1636
+ }
1637
+
1638
+ @keyframes unused {
1639
+ to {
1640
+ opacity: 0;
1641
+ }
1612
1642
}"
1613
1643
` )
1614
1644
} )
@@ -1685,6 +1715,12 @@ describe('Parsing theme values from CSS', () => {
1685
1715
to {
1686
1716
opacity: 1;
1687
1717
}
1718
+ }
1719
+
1720
+ @keyframes unused {
1721
+ to {
1722
+ opacity: 0;
1723
+ }
1688
1724
}"
1689
1725
` )
1690
1726
} )
@@ -1773,6 +1809,12 @@ describe('Parsing theme values from CSS', () => {
1773
1809
to {
1774
1810
opacity: 1;
1775
1811
}
1812
+ }
1813
+
1814
+ @keyframes unused {
1815
+ to {
1816
+ opacity: 0;
1817
+ }
1776
1818
}"
1777
1819
` )
1778
1820
} )
@@ -1822,7 +1864,7 @@ describe('Parsing theme values from CSS', () => {
1822
1864
` )
1823
1865
} )
1824
1866
1825
- test ( 'theme values added as reference are not included in the output as variables' , async ( ) => {
1867
+ test ( 'theme values added as reference are not included in the output as variables but emit fallback values ' , async ( ) => {
1826
1868
expect (
1827
1869
await compileCss (
1828
1870
css `
@@ -1875,6 +1917,16 @@ describe('Parsing theme values from CSS', () => {
1875
1917
) . toMatchInlineSnapshot ( `
1876
1918
".animate-foo {
1877
1919
animation: var(--animate-foo, foo 1s infinite);
1920
+ }
1921
+
1922
+ @keyframes foo {
1923
+ 0%, 100% {
1924
+ color: red;
1925
+ }
1926
+
1927
+ 50% {
1928
+ color: #00f;
1929
+ }
1878
1930
}"
1879
1931
` )
1880
1932
} )
@@ -1916,6 +1968,16 @@ describe('Parsing theme values from CSS', () => {
1916
1968
1917
1969
.bg-pink {
1918
1970
background-color: var(--color-pink);
1971
+ }
1972
+
1973
+ @keyframes foo {
1974
+ 0%, 100% {
1975
+ color: red;
1976
+ }
1977
+
1978
+ 50% {
1979
+ color: #00f;
1980
+ }
1919
1981
}"
1920
1982
` )
1921
1983
} )
@@ -3696,7 +3758,7 @@ it("should error when `layer(…)` is used, but it's not the first param", async
3696
3758
)
3697
3759
} )
3698
3760
3699
- describe ( '`@reference "…" reference `' , ( ) => {
3761
+ describe ( '`@reference "…" imports `' , ( ) => {
3700
3762
test ( 'recursively removes styles' , async ( ) => {
3701
3763
let loadStylesheet = async ( id : string , base : string ) => {
3702
3764
if ( id === './foo/baz.css' ) {
@@ -3851,11 +3913,17 @@ describe('`@reference "…" reference`', () => {
3851
3913
) . resolves . toMatchInlineSnapshot ( `
3852
3914
".bar {
3853
3915
animation: var(--animate-spin, spin 1s linear infinite);
3916
+ }
3917
+
3918
+ @keyframes spin {
3919
+ to {
3920
+ transform: rotate(360deg);
3921
+ }
3854
3922
}"
3855
3923
` )
3856
3924
} )
3857
3925
3858
- test ( 'emits theme variables and keyframes defined inside @reference-ed files' , async ( ) => {
3926
+ test ( 'emits CSS variable fallback and keyframes defined inside @reference-ed files' , async ( ) => {
3859
3927
let loadStylesheet = async ( id : string , base : string ) => {
3860
3928
switch ( id ) {
3861
3929
case './one.css' : {
@@ -3915,6 +3983,16 @@ describe('`@reference "…" reference`', () => {
3915
3983
".bar {
3916
3984
animation: var(--animate-wiggle, wiggle 1s ease-in-out infinite);
3917
3985
color: var(--color-red, red);
3986
+ }
3987
+
3988
+ @keyframes wiggle {
3989
+ 0%, 100% {
3990
+ transform: rotate(-3deg);
3991
+ }
3992
+
3993
+ 50% {
3994
+ transform: rotate(3deg);
3995
+ }
3918
3996
}"
3919
3997
` )
3920
3998
} )
0 commit comments