@@ -382,6 +382,145 @@ testWithMedia =
382
382
]
383
383
384
384
385
+ withMediaOutside : Test
386
+ withMediaOutside =
387
+ let
388
+ input =
389
+ stylesheet
390
+ [ body
391
+ [ Css . color ( hex " ff0000" )
392
+ , nthOfType " 2n+1"
393
+ [ withMedia [ only screen [ Media . minWidth ( px 600 ) ] ]
394
+ [ marginRight ( px 16 ) ]
395
+ ]
396
+ ]
397
+ ]
398
+
399
+ output =
400
+ """
401
+ body {
402
+ color:#ff0000;
403
+ }
404
+
405
+ @media only screen and (min-width: 600px) {
406
+ body:nth-of-type(2n+1) {
407
+ margin-right:16px;
408
+ }
409
+ }
410
+ """
411
+ in
412
+ describe " withMedia on the outside"
413
+ [ test " pretty prints the expected output" <|
414
+ \ _ ->
415
+ outdented ( prettyPrint input)
416
+ |> Expect . equal ( outdented output)
417
+ ]
418
+
419
+
420
+ withMediaOutsideAndOtherDeclarations : Test
421
+ withMediaOutsideAndOtherDeclarations =
422
+ let
423
+ input =
424
+ stylesheet
425
+ [ body
426
+ [ Css . color ( hex " ff0000" )
427
+ , nthOfType " 2n+1"
428
+ [ withMedia [ only screen [ Media . minWidth ( px 600 ) ] ]
429
+ [ marginRight ( px 16 ) ]
430
+ ]
431
+ , Css . backgroundColor ( hex " 0000aa" )
432
+ ]
433
+ ]
434
+
435
+ output =
436
+ """
437
+ body {
438
+ color:#ff0000;
439
+ background-color:#0000aa;
440
+ }
441
+
442
+ @media only screen and (min-width: 600px) {
443
+ body:nth-of-type(2n+1) {
444
+ margin-right:16px;
445
+ }
446
+ }
447
+ """
448
+ in
449
+ describe " withMedia on the outside and other declarations"
450
+ [ test " pretty prints the expected output" <|
451
+ \ _ ->
452
+ outdented ( prettyPrint input)
453
+ |> Expect . equal ( outdented output)
454
+ ]
455
+
456
+
457
+ withMediaInside : Test
458
+ withMediaInside =
459
+ let
460
+ input =
461
+ stylesheet
462
+ [ body
463
+ [ withMedia [ only screen [ Media . minWidth ( px 600 ) ] ]
464
+ [ nthOfType " 2n+1"
465
+ [ marginRight ( px 16 ) ]
466
+ ]
467
+ ]
468
+ ]
469
+
470
+ output =
471
+ """
472
+ @media only screen and (min-width: 600px) {
473
+ body:nth-of-type(2n+1) {
474
+ margin-right:16px;
475
+ }
476
+ }
477
+ """
478
+ in
479
+ describe " withMedia on the inside"
480
+ [ test " pretty prints the expected output" <|
481
+ \ _ ->
482
+ outdented ( prettyPrint input)
483
+ |> Expect . equal ( outdented output)
484
+ ]
485
+
486
+
487
+ withMediaInsideAndOtheDeclarations : Test
488
+ withMediaInsideAndOtheDeclarations =
489
+ let
490
+ input =
491
+ stylesheet
492
+ [ body
493
+ [ Css . color ( hex " ff0000" )
494
+ , withMedia [ only screen [ Media . minWidth ( px 600 ) ] ]
495
+ [ nthOfType " 2n+1"
496
+ [ marginRight ( px 16 ) ]
497
+ ]
498
+ , Css . backgroundColor ( hex " 0000aa" )
499
+ ]
500
+ ]
501
+
502
+ output =
503
+ """
504
+ body {
505
+ color:#ff0000;
506
+ background-color:#0000aa;
507
+ }
508
+
509
+ @media only screen and (min-width: 600px) {
510
+ body:nth-of-type(2n+1) {
511
+ margin-right:16px;
512
+ }
513
+ }
514
+ """
515
+ in
516
+ describe " withMedia on the inside and other declarations"
517
+ [ test " pretty prints the expected output" <|
518
+ \ _ ->
519
+ outdented ( prettyPrint input)
520
+ |> Expect . equal ( outdented output)
521
+ ]
522
+
523
+
385
524
bug352 : Test
386
525
bug352 =
387
526
let
0 commit comments