@@ -51,7 +51,7 @@ crosscheck(() => {
51
51
[ 'px-3 focus:hover:p-3 hover:p-1 py-3' , 'px-3 py-3 hover:p-1 focus:hover:p-3' ] ,
52
52
53
53
// Utitlies with important
54
- [ 'px-3 !py-4' , 'px-3 !py-4' ] ,
54
+ [ 'px-3 !py-4' , '!py-4 px-3 ' ] ,
55
55
[ '!py-4 px-3' , '!py-4 px-3' ] ,
56
56
57
57
// Components with variants
@@ -89,7 +89,7 @@ crosscheck(() => {
89
89
] ,
90
90
91
91
// Utitlies with important
92
- [ 'tw-px-3 !tw-py-4' , 'tw-px-3 ! tw-py-4 ' ] ,
92
+ [ 'tw-px-3 !tw-py-4' , '! tw-py-4 tw-px-3 ' ] ,
93
93
[ '!tw-py-4 tw-px-3' , '!tw-py-4 tw-px-3' ] ,
94
94
95
95
// Components with variants
@@ -115,4 +115,31 @@ crosscheck(() => {
115
115
expect ( defaultSort ( context . getClassOrder ( input . split ( ' ' ) ) ) ) . toEqual ( output )
116
116
}
117
117
)
118
+
119
+ it ( 'sorts classes deterministically across multiple class lists' , ( ) => {
120
+ let classes = [
121
+ [
122
+ 'a-class px-3 p-1 b-class py-3 bg-red-500 bg-blue-500' ,
123
+ 'a-class b-class bg-blue-500 bg-red-500 p-1 px-3 py-3' ,
124
+ ] ,
125
+ [
126
+ 'px-3 b-class p-1 py-3 bg-blue-500 a-class bg-red-500' ,
127
+ 'b-class a-class bg-blue-500 bg-red-500 p-1 px-3 py-3' ,
128
+ ] ,
129
+ ]
130
+
131
+ let config = { }
132
+
133
+ // Same context, different class lists
134
+ let context = createContext ( resolveConfig ( config ) )
135
+ for ( const [ input , output ] of classes ) {
136
+ expect ( defaultSort ( context . getClassOrder ( input . split ( ' ' ) ) ) ) . toEqual ( output )
137
+ }
138
+
139
+ // Different context, different class lists
140
+ for ( const [ input , output ] of classes ) {
141
+ context = createContext ( resolveConfig ( config ) )
142
+ expect ( defaultSort ( context . getClassOrder ( input . split ( ' ' ) ) ) ) . toEqual ( output )
143
+ }
144
+ } )
118
145
} )
0 commit comments