@@ -3148,6 +3148,230 @@ test('max-height', async () => {
3148
3148
) . toEqual ( '' )
3149
3149
} )
3150
3150
3151
+ describe ( 'container' , ( ) => {
3152
+ test ( 'creates the right media queries and sorts it before width' , async ( ) => {
3153
+ expect (
3154
+ await compileCss (
3155
+ css `
3156
+ @theme {
3157
+ --breakpoint-sm : 40rem ;
3158
+ --breakpoint-md : 48rem ;
3159
+ --breakpoint-lg : 64rem ;
3160
+ --breakpoint-xl : 80rem ;
3161
+ --breakpoint-2xl : 96rem ;
3162
+ }
3163
+ @tailwind utilities;
3164
+ ` ,
3165
+ [ 'w-1/2' , 'container' , 'max-w-[var(--breakpoint-sm)]' ] ,
3166
+ ) ,
3167
+ ) . toMatchInlineSnapshot ( `
3168
+ ":root {
3169
+ --breakpoint-sm: 40rem;
3170
+ --breakpoint-md: 48rem;
3171
+ --breakpoint-lg: 64rem;
3172
+ --breakpoint-xl: 80rem;
3173
+ --breakpoint-2xl: 96rem;
3174
+ }
3175
+
3176
+ .container {
3177
+ width: 100%;
3178
+ }
3179
+
3180
+ @media (width >= 40rem) {
3181
+ .container {
3182
+ max-width: 40rem;
3183
+ }
3184
+ }
3185
+
3186
+ @media (width >= 48rem) {
3187
+ .container {
3188
+ max-width: 48rem;
3189
+ }
3190
+ }
3191
+
3192
+ @media (width >= 64rem) {
3193
+ .container {
3194
+ max-width: 64rem;
3195
+ }
3196
+ }
3197
+
3198
+ @media (width >= 80rem) {
3199
+ .container {
3200
+ max-width: 80rem;
3201
+ }
3202
+ }
3203
+
3204
+ @media (width >= 96rem) {
3205
+ .container {
3206
+ max-width: 96rem;
3207
+ }
3208
+ }
3209
+
3210
+ .w-1\\/2 {
3211
+ width: 50%;
3212
+ }
3213
+
3214
+ .max-w-\\[var\\(--breakpoint-sm\\)\\] {
3215
+ max-width: var(--breakpoint-sm);
3216
+ }"
3217
+ ` )
3218
+ } )
3219
+
3220
+ test ( 'sorts breakpoints based on unit and then in ascending aOrder' , async ( ) => {
3221
+ expect (
3222
+ await compileCss (
3223
+ css `
3224
+ @theme reference {
3225
+ --breakpoint-lg : 64rem ;
3226
+ --breakpoint-xl : 80rem ;
3227
+ --breakpoint-3xl : 1600px ;
3228
+ --breakpoint-sm : 40em ;
3229
+ --breakpoint-2xl : 96rem ;
3230
+ --breakpoint-xs : 30px ;
3231
+ --breakpoint-md : 48em ;
3232
+ }
3233
+ @tailwind utilities;
3234
+ ` ,
3235
+ [ 'container' ] ,
3236
+ ) ,
3237
+ ) . toMatchInlineSnapshot ( `
3238
+ ".container {
3239
+ width: 100%;
3240
+ }
3241
+
3242
+ @media (width >= 40em) {
3243
+ .container {
3244
+ max-width: 40em;
3245
+ }
3246
+ }
3247
+
3248
+ @media (width >= 48em) {
3249
+ .container {
3250
+ max-width: 48em;
3251
+ }
3252
+ }
3253
+
3254
+ @media (width >= 30px) {
3255
+ .container {
3256
+ max-width: 30px;
3257
+ }
3258
+ }
3259
+
3260
+ @media (width >= 1600px) {
3261
+ .container {
3262
+ max-width: 1600px;
3263
+ }
3264
+ }
3265
+
3266
+ @media (width >= 64rem) {
3267
+ .container {
3268
+ max-width: 64rem;
3269
+ }
3270
+ }
3271
+
3272
+ @media (width >= 80rem) {
3273
+ .container {
3274
+ max-width: 80rem;
3275
+ }
3276
+ }
3277
+
3278
+ @media (width >= 96rem) {
3279
+ .container {
3280
+ max-width: 96rem;
3281
+ }
3282
+ }"
3283
+ ` )
3284
+ } )
3285
+
3286
+ test ( 'custom `@utility container` always follow the core utility ' , async ( ) => {
3287
+ expect (
3288
+ await compileCss (
3289
+ css `
3290
+ @theme {
3291
+ --breakpoint-sm : 40rem ;
3292
+ --breakpoint-md : 48rem ;
3293
+ --breakpoint-lg : 64rem ;
3294
+ --breakpoint-xl : 80rem ;
3295
+ --breakpoint-2xl : 96rem ;
3296
+ }
3297
+ @tailwind utilities;
3298
+
3299
+ @utility container {
3300
+ margin-inline : auto;
3301
+ padding-inline : 1rem ;
3302
+
3303
+ @media (width > = theme(- - breakpoint- sm)) {
3304
+ padding-inline : 2rem ;
3305
+ }
3306
+ }
3307
+ ` ,
3308
+ [ 'w-1/2' , 'container' , 'max-w-[var(--breakpoint-sm)]' ] ,
3309
+ ) ,
3310
+ ) . toMatchInlineSnapshot ( `
3311
+ ":root {
3312
+ --breakpoint-sm: 40rem;
3313
+ --breakpoint-md: 48rem;
3314
+ --breakpoint-lg: 64rem;
3315
+ --breakpoint-xl: 80rem;
3316
+ --breakpoint-2xl: 96rem;
3317
+ }
3318
+
3319
+ .container {
3320
+ width: 100%;
3321
+ }
3322
+
3323
+ @media (width >= 40rem) {
3324
+ .container {
3325
+ max-width: 40rem;
3326
+ }
3327
+ }
3328
+
3329
+ @media (width >= 48rem) {
3330
+ .container {
3331
+ max-width: 48rem;
3332
+ }
3333
+ }
3334
+
3335
+ @media (width >= 64rem) {
3336
+ .container {
3337
+ max-width: 64rem;
3338
+ }
3339
+ }
3340
+
3341
+ @media (width >= 80rem) {
3342
+ .container {
3343
+ max-width: 80rem;
3344
+ }
3345
+ }
3346
+
3347
+ @media (width >= 96rem) {
3348
+ .container {
3349
+ max-width: 96rem;
3350
+ }
3351
+ }
3352
+
3353
+ .container {
3354
+ margin-inline: auto;
3355
+ padding-inline: 1rem;
3356
+ }
3357
+
3358
+ @media (width >= 40rem) {
3359
+ .container {
3360
+ padding-inline: 2rem;
3361
+ }
3362
+ }
3363
+
3364
+ .w-1\\/2 {
3365
+ width: 50%;
3366
+ }
3367
+
3368
+ .max-w-\\[var\\(--breakpoint-sm\\)\\] {
3369
+ max-width: var(--breakpoint-sm);
3370
+ }"
3371
+ ` )
3372
+ } )
3373
+ } )
3374
+
3151
3375
test ( 'flex' , async ( ) => {
3152
3376
expect (
3153
3377
await run ( [
@@ -16680,7 +16904,7 @@ describe('spacing utilities', () => {
16680
16904
` )
16681
16905
} )
16682
16906
16683
- test ( 'only multiples of 0.25 with no trailing zeroes are supported with the spacing multipler ' , async ( ) => {
16907
+ test ( 'only multiples of 0.25 with no trailing zeroes are supported with the spacing multiplier ' , async ( ) => {
16684
16908
let { build } = await compile ( css `
16685
16909
@theme {
16686
16910
--spacing : 4px ;
0 commit comments