@@ -14,7 +14,7 @@ test.each([
14
14
[ '[--value:theme(spacing[1.25])]' , '[--value:--spacing(1.25)]' ] ,
15
15
16
16
// 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])]' ] ,
18
18
19
19
// Convert to `var(…)` if we can resolve the path
20
20
[ '[color:theme(colors.red.500)]' , '[color:var(--color-red-500)]' ] , // Arbitrary property
@@ -26,13 +26,13 @@ test.each([
26
26
[ 'bg-[theme(colors.red.500,red)]' , 'bg-(--color-red-500,red)' ] ,
27
27
28
28
// 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)]' ] ,
30
30
31
31
// Keep `theme(…)` if we can't resolve the path, but still try to convert the
32
32
// fallback value.
33
33
[
34
34
'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))]' ,
36
36
] ,
37
37
38
38
// Use `theme(…)` (deeply nested) inside of a `calc(…)` function
@@ -92,35 +92,35 @@ test.each([
92
92
// still upgrade the `theme(…)` to the modern syntax.
93
93
[ 'max-[theme(screens.lg)]:flex' , 'max-[--theme(--breakpoint-lg)]:flex' ] ,
94
94
// 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' ] ,
96
96
97
97
// This test in itself doesn't make much sense. But we need to make sure
98
98
// 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' ] ,
100
100
101
101
// `theme(…)` calls in another CSS function is replaced correctly.
102
102
// Additionally we remove unnecessary whitespace.
103
103
[ 'grid-cols-[min(50%_,_theme(spacing.80))_auto]' , 'grid-cols-[min(50%,--spacing(80))_auto]' ] ,
104
104
105
105
// `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)]' ] ,
107
107
108
108
// Renamed theme keys
109
109
[ 'max-w-[theme(screens.md)]' , 'max-w-(--breakpoint-md)' ] ,
110
110
[ 'w-[theme(maxWidth.md)]' , 'w-(--container-md)' ] ,
111
111
112
112
// 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' ] ,
115
115
116
116
// Partially invalid cases
117
117
[
118
118
'[--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)]' ,
120
120
] ,
121
121
[
122
122
'[--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' ,
124
124
] ,
125
125
] ) ( '%s => %s' , async ( candidate , result ) => {
126
126
let designSystem = await __unstable__loadDesignSystem (
@@ -158,7 +158,7 @@ test('extended space scale converts to var or calc', async () => {
158
158
'[--value:var(--spacing-miami)]' ,
159
159
)
160
160
expect ( themeToVar ( designSystem , { } , '[--value:theme(spacing.nyc)]' ) ) . toEqual (
161
- '[--value:-- theme(spacing.nyc)]' ,
161
+ '[--value:theme(spacing.nyc)]' ,
162
162
)
163
163
} )
164
164
@@ -183,6 +183,6 @@ test('custom space scale converts to var', async () => {
183
183
'[--value:var(--spacing-2)]' ,
184
184
)
185
185
expect ( themeToVar ( designSystem , { } , '[--value:theme(spacing.3)]' ) ) . toEqual (
186
- '[--value:-- theme(spacing.3)]' ,
186
+ '[--value:theme(spacing.3)]' ,
187
187
)
188
188
} )
0 commit comments