@@ -7,8 +7,7 @@ const css = fs.readFileSync(
7
7
'utf8'
8
8
) ;
9
9
10
- // Breakpoints
11
- const BREAKPOINTS = [ 'sm' , 'md' , 'lg' , 'xl' ] ;
10
+ const INFIXES = [ '' , '-sm' , '-md' , '-lg' , '-xl' ] ;
12
11
13
12
// Align Content
14
13
// ------------------------------------------------------------
@@ -22,18 +21,11 @@ const ALIGN_CONTENT_VALUES = [
22
21
'stretch'
23
22
] ;
24
23
25
- for ( const value of ALIGN_CONTENT_VALUES ) {
26
- assert (
27
- css . includes ( `.ion-align-content-${ value } ` ) ,
28
- `CSS should include .ion-align-content-${ value } class`
29
- ) ;
30
- }
31
-
32
- for ( const bp of BREAKPOINTS ) {
24
+ for ( const infix of INFIXES ) {
33
25
for ( const value of ALIGN_CONTENT_VALUES ) {
34
26
assert (
35
- css . includes ( `.ion-align-content- ${ bp } -${ value } ` ) ,
36
- `CSS should include .ion-align-content- ${ bp } -${ value } class`
27
+ css . includes ( `.ion-align-content${ infix } -${ value } ` ) ,
28
+ `CSS should include .ion-align-content${ infix } -${ value } class`
37
29
) ;
38
30
}
39
31
}
@@ -49,18 +41,11 @@ const ALIGN_ITEMS_VALUES = [
49
41
'baseline'
50
42
] ;
51
43
52
- for ( const value of ALIGN_ITEMS_VALUES ) {
53
- assert (
54
- css . includes ( `.ion-align-items-${ value } ` ) ,
55
- `CSS should include .ion-align-items-${ value } class`
56
- ) ;
57
- }
58
-
59
- for ( const bp of BREAKPOINTS ) {
44
+ for ( const infix of INFIXES ) {
60
45
for ( const value of ALIGN_ITEMS_VALUES ) {
61
46
assert (
62
- css . includes ( `.ion-align-items- ${ bp } -${ value } ` ) ,
63
- `CSS should include .ion-align-items- ${ bp } -${ value } class`
47
+ css . includes ( `.ion-align-items${ infix } -${ value } ` ) ,
48
+ `CSS should include .ion-align-items${ infix } -${ value } class`
64
49
) ;
65
50
}
66
51
}
@@ -77,18 +62,11 @@ const ALIGN_SELF_VALUES = [
77
62
'auto'
78
63
] ;
79
64
80
- for ( const value of ALIGN_SELF_VALUES ) {
81
- assert (
82
- css . includes ( `.ion-align-self-${ value } ` ) ,
83
- `CSS should include .ion-align-self-${ value } class`
84
- ) ;
85
- }
86
-
87
- for ( const bp of BREAKPOINTS ) {
65
+ for ( const infix of INFIXES ) {
88
66
for ( const value of ALIGN_SELF_VALUES ) {
89
67
assert (
90
- css . includes ( `.ion-align-self- ${ bp } -${ value } ` ) ,
91
- `CSS should include .ion-align-self- ${ bp } -${ value } class`
68
+ css . includes ( `.ion-align-self${ infix } -${ value } ` ) ,
69
+ `CSS should include .ion-align-self${ infix } -${ value } class`
92
70
) ;
93
71
}
94
72
}
@@ -105,18 +83,11 @@ const JUSTIFY_CONTENT_VALUES = [
105
83
'evenly'
106
84
] ;
107
85
108
- for ( const value of JUSTIFY_CONTENT_VALUES ) {
109
- assert (
110
- css . includes ( `.ion-justify-content-${ value } ` ) ,
111
- `CSS should include .ion-justify-content-${ value } class`
112
- ) ;
113
- }
114
-
115
- for ( const bp of BREAKPOINTS ) {
86
+ for ( const infix of INFIXES ) {
116
87
for ( const value of JUSTIFY_CONTENT_VALUES ) {
117
88
assert (
118
- css . includes ( `.ion-justify-content- ${ bp } -${ value } ` ) ,
119
- `CSS should include .ion-justify-content- ${ bp } -${ value } class`
89
+ css . includes ( `.ion-justify-content${ infix } -${ value } ` ) ,
90
+ `CSS should include .ion-justify-content${ infix } -${ value } class`
120
91
) ;
121
92
}
122
93
}
@@ -131,18 +102,11 @@ const FLEX_DIRECTION_VALUES = [
131
102
'column-reverse'
132
103
] ;
133
104
134
- for ( const value of FLEX_DIRECTION_VALUES ) {
135
- assert (
136
- css . includes ( `.ion-flex-${ value } ` ) ,
137
- `CSS should include .ion-flex-${ value } class`
138
- ) ;
139
- }
140
-
141
- for ( const bp of BREAKPOINTS ) {
105
+ for ( const infix of INFIXES ) {
142
106
for ( const value of FLEX_DIRECTION_VALUES ) {
143
107
assert (
144
- css . includes ( `.ion-flex- ${ bp } -${ value } ` ) ,
145
- `CSS should include .ion-flex- ${ bp } -${ value } class`
108
+ css . includes ( `.ion-flex${ infix } -${ value } ` ) ,
109
+ `CSS should include .ion-flex${ infix } -${ value } class`
146
110
) ;
147
111
}
148
112
}
@@ -156,24 +120,19 @@ const FLEX_WRAP_VALUES = [
156
120
'wrap-reverse'
157
121
] ;
158
122
123
+ // TODO(FW-6697): remove assert for .ion-${value} classes
159
124
for ( const value of FLEX_WRAP_VALUES ) {
160
- // TODO(FW-6697): remove assert for .ion-${value} classes
161
125
assert (
162
126
css . includes ( `.ion-${ value } ` ) ,
163
127
`CSS should include .ion-${ value } class`
164
128
) ;
165
-
166
- assert (
167
- css . includes ( `.ion-flex-${ value } ` ) ,
168
- `CSS should include .ion-flex-${ value } class`
169
- ) ;
170
129
}
171
130
172
- for ( const bp of BREAKPOINTS ) {
131
+ for ( const infix of INFIXES ) {
173
132
for ( const value of FLEX_WRAP_VALUES ) {
174
133
assert (
175
- css . includes ( `.ion-flex- ${ bp } -${ value } ` ) ,
176
- `CSS should include .ion-flex- ${ bp } -${ value } class`
134
+ css . includes ( `.ion-flex${ infix } -${ value } ` ) ,
135
+ `CSS should include .ion-flex${ infix } -${ value } class`
177
136
) ;
178
137
}
179
138
}
@@ -188,18 +147,11 @@ const FLEX_FILL_VALUES = [
188
147
'none'
189
148
] ;
190
149
191
- for ( const value of FLEX_FILL_VALUES ) {
192
- assert (
193
- css . includes ( `.ion-flex-${ value } ` ) ,
194
- `CSS should include .ion-flex-${ value } class`
195
- ) ;
196
- }
197
-
198
- for ( const bp of BREAKPOINTS ) {
150
+ for ( const infix of INFIXES ) {
199
151
for ( const value of FLEX_FILL_VALUES ) {
200
152
assert (
201
- css . includes ( `.ion-flex- ${ bp } -${ value } ` ) ,
202
- `CSS should include .ion-flex- ${ bp } -${ value } class`
153
+ css . includes ( `.ion-flex${ infix } -${ value } ` ) ,
154
+ `CSS should include .ion-flex${ infix } -${ value } class`
203
155
) ;
204
156
}
205
157
}
@@ -212,69 +164,39 @@ const FLEX_GROW_SHRINK_VALUES = [
212
164
'shrink'
213
165
] ;
214
166
215
- for ( const value of FLEX_GROW_SHRINK_VALUES ) {
216
- assert (
217
- css . includes ( `.ion-flex-${ value } -0` ) ,
218
- `CSS should include .ion-flex-${ value } -0 class`
219
- ) ;
220
-
221
- assert (
222
- css . includes ( `.ion-flex-${ value } -1` ) ,
223
- `CSS should include .ion-flex-${ value } -1 class`
224
- ) ;
225
- }
226
-
227
- for ( const bp of BREAKPOINTS ) {
167
+ for ( const infix of INFIXES ) {
228
168
for ( const value of FLEX_GROW_SHRINK_VALUES ) {
229
169
assert (
230
- css . includes ( `.ion-flex- ${ bp } -${ value } -0` ) ,
231
- `CSS should include .ion-flex- ${ bp } -${ value } -0 class`
170
+ css . includes ( `.ion-flex${ infix } -${ value } -0` ) ,
171
+ `CSS should include .ion-flex${ infix } -${ value } -0 class`
232
172
) ;
233
173
234
174
assert (
235
- css . includes ( `.ion-flex- ${ bp } -${ value } -1` ) ,
236
- `CSS should include .ion-flex- ${ bp } -${ value } -1 class`
175
+ css . includes ( `.ion-flex${ infix } -${ value } -1` ) ,
176
+ `CSS should include .ion-flex${ infix } -${ value } -1 class`
237
177
) ;
238
178
}
239
179
}
240
180
241
181
// Flex Order
242
182
// ------------------------------------------------------------
243
183
244
- assert (
245
- css . includes ( `.ion-order-first` ) ,
246
- `CSS should include .ion-order-first class`
247
- ) ;
248
-
249
- assert (
250
- css . includes ( `.ion-order-last` ) ,
251
- `CSS should include .ion-order-last class`
252
- ) ;
253
-
254
- for ( let i = 0 ; i <= 12 ; i ++ ) {
255
- assert (
256
- css . includes ( `.ion-order-${ i } ` ) ,
257
- `CSS should include .ion-order-${ i } class`
258
- ) ;
259
- }
260
-
261
- for ( const bp of BREAKPOINTS ) {
184
+ for ( const infix of INFIXES ) {
262
185
assert (
263
- css . includes ( `.ion-order- ${ bp } -first` ) ,
264
- `CSS should include .ion-order- ${ bp } -first class`
186
+ css . includes ( `.ion-order${ infix } -first` ) ,
187
+ `CSS should include .ion-order${ infix } -first class`
265
188
) ;
266
189
267
190
assert (
268
- css . includes ( `.ion-order- ${ bp } -last` ) ,
269
- `CSS should include .ion-order- ${ bp } -last class`
191
+ css . includes ( `.ion-order${ infix } -last` ) ,
192
+ `CSS should include .ion-order${ infix } -last class`
270
193
) ;
271
194
272
195
for ( let i = 0 ; i <= 12 ; i ++ ) {
273
196
assert (
274
- css . includes ( `.ion-order- ${ bp } -${ i } ` ) ,
275
- `CSS should include .ion-order- ${ bp } -${ i } class`
197
+ css . includes ( `.ion-order${ infix } -${ i } ` ) ,
198
+ `CSS should include .ion-order${ infix } -${ i } class`
276
199
) ;
277
200
}
278
201
}
279
202
280
- console . log ( "All flex-utils.css tests pass." ) ;
0 commit comments