@@ -14,7 +14,7 @@ test.each([
1414 [ '[--value:theme(spacing[1.25])]' , '[--value:--spacing(1.25)]' ] ,
1515
1616 // Should not convert invalid spacing values to calc
17- [ '[--value:theme(spacing[1.1])]' , '[--value:-- theme(spacing[1.1])]' ] ,
17+ [ '[--value:theme(spacing[1.1])]' , '[--value:theme(spacing[1.1])]' ] ,
1818
1919 // Convert to `var(…)` if we can resolve the path
2020 [ '[color:theme(colors.red.500)]' , '[color:var(--color-red-500)]' ] , // Arbitrary property
@@ -26,13 +26,13 @@ test.each([
2626 [ 'bg-[theme(colors.red.500,red)]' , 'bg-(--color-red-500,red)' ] ,
2727
2828 // Keep `theme(…)` if we can't resolve the path
29- [ 'bg-[theme(colors.foo.1000)]' , 'bg-[-- theme(colors.foo.1000)]' ] ,
29+ [ 'bg-[theme(colors.foo.1000)]' , 'bg-[theme(colors.foo.1000)]' ] ,
3030
3131 // Keep `theme(…)` if we can't resolve the path, but still try to convert the
3232 // fallback value.
3333 [
3434 'bg-[theme(colors.foo.1000,theme(colors.red.500))]' ,
35- 'bg-[-- theme(colors.foo.1000,var(--color-red-500))]' ,
35+ 'bg-[theme(colors.foo.1000,var(--color-red-500))]' ,
3636 ] ,
3737
3838 // Use `theme(…)` (deeply nested) inside of a `calc(…)` function
@@ -92,35 +92,35 @@ test.each([
9292 // still upgrade the `theme(…)` to the modern syntax.
9393 [ 'max-[theme(screens.lg)]:flex' , 'max-[--theme(--breakpoint-lg)]:flex' ] ,
9494 // There are no variables for `--spacing` multiples, so we can't convert this
95- [ 'max-[theme(spacing.4)]:flex' , 'max-[-- theme(spacing.4)]:flex' ] ,
95+ [ 'max-[theme(spacing.4)]:flex' , 'max-[theme(spacing.4)]:flex' ] ,
9696
9797 // This test in itself doesn't make much sense. But we need to make sure
9898 // that this doesn't end up as the modifier in the candidate itself.
99- [ 'max-[theme(spacing.4/50)]:flex' , 'max-[-- theme(spacing.4/50)]:flex' ] ,
99+ [ 'max-[theme(spacing.4/50)]:flex' , 'max-[theme(spacing.4/50)]:flex' ] ,
100100
101101 // `theme(…)` calls in another CSS function is replaced correctly.
102102 // Additionally we remove unnecessary whitespace.
103103 [ 'grid-cols-[min(50%_,_theme(spacing.80))_auto]' , 'grid-cols-[min(50%,--spacing(80))_auto]' ] ,
104104
105105 // `theme(…)` calls valid in v3, but not in v4 should still be converted.
106- [ '[--foo:theme(transitionDuration.500)]' , '[--foo:-- theme(transitionDuration.500)]' ] ,
106+ [ '[--foo:theme(transitionDuration.500)]' , '[--foo:theme(transitionDuration.500)]' ] ,
107107
108108 // Renamed theme keys
109109 [ 'max-w-[theme(screens.md)]' , 'max-w-(--breakpoint-md)' ] ,
110110 [ 'w-[theme(maxWidth.md)]' , 'w-(--container-md)' ] ,
111111
112112 // Invalid cases
113- [ '[--foo:theme(colors.red.500/50/50)]' , '[--foo:-- theme(colors.red.500/50/50)]' ] ,
114- [ '[--foo:theme(colors.red.500/50/50)]/50' , '[--foo:-- theme(colors.red.500/50/50)]/50' ] ,
113+ [ '[--foo:theme(colors.red.500/50/50)]' , '[--foo:theme(colors.red.500/50/50)]' ] ,
114+ [ '[--foo:theme(colors.red.500/50/50)]/50' , '[--foo:theme(colors.red.500/50/50)]/50' ] ,
115115
116116 // Partially invalid cases
117117 [
118118 '[--foo:theme(colors.red.500/50/50)_theme(colors.blue.200)]' ,
119- '[--foo:-- theme(colors.red.500/50/50)_var(--color-blue-200)]' ,
119+ '[--foo:theme(colors.red.500/50/50)_var(--color-blue-200)]' ,
120120 ] ,
121121 [
122122 '[--foo:theme(colors.red.500/50/50)_theme(colors.blue.200)]/50' ,
123- '[--foo:-- theme(colors.red.500/50/50)_var(--color-blue-200)]/50' ,
123+ '[--foo:theme(colors.red.500/50/50)_var(--color-blue-200)]/50' ,
124124 ] ,
125125] ) ( '%s => %s' , async ( candidate , result ) => {
126126 let designSystem = await __unstable__loadDesignSystem (
@@ -158,7 +158,7 @@ test('extended space scale converts to var or calc', async () => {
158158 '[--value:var(--spacing-miami)]' ,
159159 )
160160 expect ( themeToVar ( designSystem , { } , '[--value:theme(spacing.nyc)]' ) ) . toEqual (
161- '[--value:-- theme(spacing.nyc)]' ,
161+ '[--value:theme(spacing.nyc)]' ,
162162 )
163163} )
164164
@@ -183,6 +183,6 @@ test('custom space scale converts to var', async () => {
183183 '[--value:var(--spacing-2)]' ,
184184 )
185185 expect ( themeToVar ( designSystem , { } , '[--value:theme(spacing.3)]' ) ) . toEqual (
186- '[--value:-- theme(spacing.3)]' ,
186+ '[--value:theme(spacing.3)]' ,
187187 )
188188} )
0 commit comments