@@ -9,12 +9,17 @@ import { migrateModernizeArbitraryValues } from './migrate-modernize-arbitrary-v
9
9
import { migratePrefix } from './migrate-prefix'
10
10
vi . spyOn ( versions , 'isMajor' ) . mockReturnValue ( true )
11
11
12
+ const css = String . raw
13
+
12
14
function migrate ( designSystem : DesignSystem , userConfig : UserConfig | null , rawCandidate : string ) {
13
15
for ( let migration of [
14
16
migrateEmptyArbitraryValues ,
15
17
migratePrefix ,
16
18
migrateModernizeArbitraryValues ,
17
19
migrateArbitraryVariants ,
20
+ ( designSystem : DesignSystem , _ , rawCandidate : string ) => {
21
+ return designSystem . canonicalizeCandidates ( [ rawCandidate ] ) . pop ( ) ?? rawCandidate
22
+ } ,
18
23
] ) {
19
24
rawCandidate = migration ( designSystem , userConfig , rawCandidate )
20
25
}
@@ -37,9 +42,15 @@ test.each([
37
42
[ 'not-group-[]:flex' , 'not-in-[.group]:flex' ] ,
38
43
[ 'not-group-[]/name:flex' , 'not-in-[.group\\/name]:flex' ] ,
39
44
] ) ( '%s => %s (%#)' , async ( candidate , result ) => {
40
- let designSystem = await __unstable__loadDesignSystem ( '@import "tailwindcss";' , {
41
- base : __dirname ,
42
- } )
45
+ let designSystem = await __unstable__loadDesignSystem (
46
+ css `
47
+ @import 'tailwindcss' ;
48
+ @theme {
49
+ -- * : initial;
50
+ }
51
+ ` ,
52
+ { base : __dirname } ,
53
+ )
43
54
44
55
expect ( migrate ( designSystem , { } , candidate ) ) . toEqual ( result )
45
56
} )
@@ -66,9 +77,15 @@ test.each([
66
77
[ 'not-group-[]:tw-flex' , 'tw:not-in-[.tw\\:group]:flex' ] ,
67
78
[ 'not-group-[]/name:tw-flex' , 'tw:not-in-[.tw\\:group\\/name]:flex' ] ,
68
79
] ) ( '%s => %s (%#)' , async ( candidate , result ) => {
69
- let designSystem = await __unstable__loadDesignSystem ( '@import "tailwindcss" prefix(tw);' , {
70
- base : __dirname ,
71
- } )
80
+ let designSystem = await __unstable__loadDesignSystem (
81
+ css `
82
+ @import 'tailwindcss' prefix(tw);
83
+ @theme {
84
+ -- * : initial;
85
+ }
86
+ ` ,
87
+ { base : __dirname } ,
88
+ )
72
89
73
90
expect ( migrate ( designSystem , { prefix : 'tw-' } , candidate ) ) . toEqual ( result )
74
91
} )
0 commit comments