Commit c315db5 1 parent 4f89215 commit c315db5 Copy full SHA for c315db5
File tree 1 file changed +131
-0
lines changed
1 file changed +131
-0
lines changed Original file line number Diff line number Diff line change @@ -49,3 +49,134 @@ test('custom user-land utilities', () => {
49
49
` )
50
50
} )
51
51
} )
52
+
53
+ test ( 'layers are grouped and inserted at the matching @tailwind rule' , ( ) => {
54
+ let config = {
55
+ content : [
56
+ { raw : html `<div class= "input btn card float-squirrel align-banana align-sandwich" > </ div> ` } ,
57
+ ] ,
58
+ plugins : [
59
+ function ( { addBase, addComponents, addUtilities } ) {
60
+ addBase ( { body : { margin : 0 } } )
61
+
62
+ addComponents ( {
63
+ '.input' : { background : 'white' } ,
64
+ } )
65
+
66
+ addUtilities ( {
67
+ '.float-squirrel' : { float : 'squirrel' } ,
68
+ } )
69
+ } ,
70
+ ] ,
71
+ corePlugins : { preflight : false } ,
72
+ }
73
+
74
+ let input = css `
75
+ @layer vanilla {
76
+ strong {
77
+ font-weight : medium;
78
+ }
79
+ }
80
+
81
+ @tailwind base;
82
+ @tailwind components;
83
+ @tailwind utilities;
84
+
85
+ @layer components {
86
+ .btn {
87
+ background : blue;
88
+ }
89
+ }
90
+
91
+ @layer utilities {
92
+ .align-banana {
93
+ text-align : banana;
94
+ }
95
+ }
96
+
97
+ @layer base {
98
+ h1 {
99
+ font-weight : bold;
100
+ }
101
+ }
102
+
103
+ @layer components {
104
+ .card {
105
+ border-radius : 12px ;
106
+ }
107
+ }
108
+
109
+ @layer base {
110
+ p {
111
+ font-weight : normal;
112
+ }
113
+ }
114
+
115
+ @layer utilities {
116
+ .align-sandwich {
117
+ text-align : sandwich;
118
+ }
119
+ }
120
+
121
+ @layer chocolate {
122
+ a {
123
+ text-decoration : underline;
124
+ }
125
+ }
126
+ `
127
+
128
+ expect . assertions ( 2 )
129
+
130
+ return run ( input , config ) . then ( ( result ) => {
131
+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
132
+ expect ( result . css ) . toMatchFormattedCss ( css `
133
+ @layer vanilla {
134
+ strong {
135
+ font-weight : medium;
136
+ }
137
+ }
138
+
139
+ body {
140
+ margin : 0 ;
141
+ }
142
+
143
+ h1 {
144
+ font-weight : bold;
145
+ }
146
+
147
+ p {
148
+ font-weight : normal;
149
+ }
150
+
151
+ .input {
152
+ background : white;
153
+ }
154
+
155
+ .btn {
156
+ background : blue;
157
+ }
158
+
159
+ .card {
160
+ border-radius : 12px ;
161
+ }
162
+
163
+ .float-squirrel {
164
+ float : squirrel;
165
+ }
166
+
167
+ .align-banana {
168
+ text-align : banana;
169
+ }
170
+
171
+ .align-sandwich {
172
+ text-align : sandwich;
173
+ }
174
+
175
+ @layer chocolate {
176
+ a {
177
+ text-decoration : underline;
178
+ }
179
+ }
180
+ ` )
181
+ } )
182
+ } )
You can’t perform that action at this time.
0 commit comments