@@ -122,9 +122,7 @@ describe('styled component behaviour', () => {
122
122
]);
123
123
` ) ;
124
124
125
- expect ( actual ) . toInclude ( '{font-size:12px}' ) ;
126
- expect ( actual ) . toInclude ( '{color:blue}' ) ;
127
- expect ( actual ) . toInclude ( '{font-weight:500}' ) ;
125
+ expect ( actual ) . toIncludeMultiple ( [ '{font-size:12px}' , '{color:blue}' , '{font-weight:500}' ] ) ;
128
126
} ) ;
129
127
130
128
it ( 'should not destructure valid html attributes from props' , ( ) => {
@@ -256,8 +254,10 @@ describe('styled component behaviour', () => {
256
254
});
257
255
` ) ;
258
256
259
- expect ( actual ) . toInclude ( '{color:var(--_63bh2t)}' ) ;
260
- expect ( actual ) . toInclude ( '"--_63bh2t":ix((()=>{return __cmplp.color;})())' ) ;
257
+ expect ( actual ) . toIncludeMultiple ( [
258
+ '{color:var(--_63bh2t)}' ,
259
+ '"--_63bh2t":ix((()=>{return __cmplp.color;})())' ,
260
+ ] ) ;
261
261
} ) ;
262
262
263
263
it ( 'should transform an arrow function with a body into an IIFE by preventing passing down invalid html attributes to the node' , ( ) => {
@@ -269,9 +269,11 @@ describe('styled component behaviour', () => {
269
269
});
270
270
` ) ;
271
271
272
- expect ( actual ) . toInclude ( '{font-size:var(--_1eiw442)}' ) ;
273
- expect ( actual ) . toInclude ( 'const{textSize,...__cmpldp}=__cmplp;' ) ;
274
- expect ( actual ) . toInclude ( '"--_1eiw442":ix((()=>{return __cmplp.textSize;})())' ) ;
272
+ expect ( actual ) . toIncludeMultiple ( [
273
+ '{font-size:var(--_1eiw442)}' ,
274
+ 'const{textSize,...__cmpldp}=__cmplp;' ,
275
+ '"--_1eiw442":ix((()=>{return __cmplp.textSize;})())' ,
276
+ ] ) ;
275
277
} ) ;
276
278
277
279
it ( 'should move suffix and prefix of a dynamic arrow function with a body into an IIFE' , ( ) => {
@@ -283,8 +285,10 @@ describe('styled component behaviour', () => {
283
285
});
284
286
` ) ;
285
287
286
- expect ( actual ) . toInclude ( '{content:var(--_63bh2t)}' ) ;
287
- expect ( actual ) . toInclude ( '"--_63bh2t":ix((()=>{return __cmplp.color;})(),"\\"","\\"")' ) ;
288
+ expect ( actual ) . toIncludeMultiple ( [
289
+ '{content:var(--_63bh2t)}' ,
290
+ '"--_63bh2t":ix((()=>{return __cmplp.color;})(),"\\"","\\"")' ,
291
+ ] ) ;
288
292
} ) ;
289
293
290
294
it ( 'should collect args as styles' , ( ) => {
@@ -531,7 +535,7 @@ describe('styled component behaviour', () => {
531
535
'._ca0qftgi{padding-top:8px}' ,
532
536
'._19itlf8h{border:2px solid blue}' ,
533
537
'._1wyb1ul9{font-size:30px}' ,
534
- 'ax(["_1wyb1ul9 _19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi",__cmplp.isPrimary?"_syaz13q2":"_syaz5scu",__cmplp.isDone?"_1hms1911":"_1hmsglyw",__cmplp.isClamped?"_1yyj11wp":"_1yyjkb7n",__cmplp.className])' ,
538
+ 'ax(["_19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi _1wyb1ul9 ",__cmplp.isPrimary?"_syaz13q2":"_syaz5scu",__cmplp.isDone?"_1hms1911":"_1hmsglyw",__cmplp.isClamped?"_1yyj11wp":"_1yyjkb7n",__cmplp.className])' ,
535
539
] ) ;
536
540
} ) ;
537
541
@@ -624,11 +628,8 @@ describe('styled component behaviour', () => {
624
628
'._syaz5scu{color:red}' ,
625
629
'._syaz13q2{color:blue}' ,
626
630
'._1wyb1ul9{font-size:30px}' ,
631
+ `ax([\"_1wyb1ul9\",__cmplp.isPrimary?\"_syaz13q2\":\"_syaz5scu\",__cmplp.isPrimary?\"_19it1nsd\":\"_19it107e\",__cmplp.className]` ,
627
632
] ) ;
628
-
629
- expect ( actual ) . toInclude (
630
- `ax([\"_1wyb1ul9\",__cmplp.isPrimary?\"_syaz13q2\":\"_syaz5scu\",__cmplp.isPrimary?\"_19it1nsd\":\"_19it107e\",__cmplp.className]`
631
- ) ;
632
633
} ) ;
633
634
634
635
it ( 'should apply conditional CSS with nested ternary operators' , ( ) => {
@@ -653,7 +654,7 @@ describe('styled component behaviour', () => {
653
654
'._syaz5scu{color:red}' ,
654
655
'._syaz13q2{color:blue}' ,
655
656
'._syaz11x8{color:black}' ,
656
- `ax([\"_1wyb1ul9 _19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi\",__cmplp.isPrimary?__cmplp.isDisabled?\"_syaz11x8\":\"_syaz13q2\":\"_syaz5scu\",__cmplp.className])` ,
657
+ `ax([\"_19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi _1wyb1ul9 \",__cmplp.isPrimary?__cmplp.isDisabled?\"_syaz11x8\":\"_syaz13q2\":\"_syaz5scu\",__cmplp.className])` ,
657
658
] ) ;
658
659
} ) ;
659
660
@@ -674,11 +675,8 @@ describe('styled component behaviour', () => {
674
675
'._19it7fe6{border:3px solid yellow}' ,
675
676
'._bfhk1x77{background-color:white}' ,
676
677
'._syaz5scu{color:red}' ,
678
+ 'className={ax(["_bfhk1x77 _19it7fe6 _syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}' ,
677
679
] ) ;
678
-
679
- expect ( actual ) . toInclude (
680
- 'className={ax(["_syaz5scu _bfhk1x77 _19it7fe6",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}'
681
- ) ;
682
680
} ) ;
683
681
684
682
it ( 'should apply conditional CSS with template literal and nested ternary operators' , ( ) => {
@@ -733,11 +731,8 @@ describe('styled component behaviour', () => {
733
731
'._k48p8n31{font-weight:bold}' ,
734
732
'._syaz13q2{color:blue}' ,
735
733
'._syaz5scu{color:red}' ,
734
+ 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.isBolded&&"_k48p8n31",__cmplp.className])}' ,
736
735
] ) ;
737
-
738
- expect ( actual ) . toInclude (
739
- 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.isBolded&&"_k48p8n31",__cmplp.className])}'
740
- ) ;
741
736
} ) ;
742
737
743
738
it ( 'should not allow a logical statement with a conditional right-hand side' , ( ) => {
@@ -838,11 +833,8 @@ describe('styled component behaviour', () => {
838
833
'._19it7fe6{border:3px solid yellow}' ,
839
834
'._bfhk1x77{background-color:white}' ,
840
835
'._syaz5scu{color:red}' ,
836
+ '{ax(["_bfhk1x77 _19it7fe6 _syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}' ,
841
837
] ) ;
842
-
843
- expect ( actual ) . toInclude (
844
- '{ax(["_syaz5scu _bfhk1x77 _19it7fe6",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}'
845
- ) ;
846
838
} ) ;
847
839
848
840
it ( 'should apply unconditional after a conditional css rule with template literal' , ( ) => {
@@ -862,11 +854,8 @@ describe('styled component behaviour', () => {
862
854
'._bfhk1x77{background-color:white}' ,
863
855
'._syaz5scu{color:red}' ,
864
856
'._19it7fe6{border:3px solid yellow}' ,
857
+ '{ax(["_19it7fe6 _bfhk1x77 _syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}' ,
865
858
] ) ;
866
-
867
- expect ( actual ) . toInclude (
868
- '{ax(["_19it7fe6 _syaz5scu _bfhk1x77",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}'
869
- ) ;
870
859
} ) ;
871
860
872
861
it ( 'should apply unconditional CSS with props' , ( ) => {
@@ -881,9 +870,8 @@ describe('styled component behaviour', () => {
881
870
expect ( actual ) . toIncludeMultiple ( [
882
871
'const _="._syaz1q2z{color:var(--_1r7cl4y)}"' ,
883
872
'"--_1r7cl4y":ix(__cmplp.primary)' ,
873
+ 'className={ax(["_syaz1q2z",__cmplp.className])}' ,
884
874
] ) ;
885
-
886
- expect ( actual ) . toInclude ( 'className={ax(["_syaz1q2z",__cmplp.className])}' ) ;
887
875
} ) ;
888
876
889
877
it ( 'should apply unconditional CSS with and without props' , ( ) => {
@@ -900,9 +888,8 @@ describe('styled component behaviour', () => {
900
888
'._syaz1q2z{color:var(--_1r7cl4y)}' ,
901
889
'._bfhk5scu{background-color:red}' ,
902
890
'--_1r7cl4y":ix(__cmplp.primary)}' ,
891
+ 'className={ax(["_bfhk5scu _syaz1q2z",__cmplp.className])}' ,
903
892
] ) ;
904
-
905
- expect ( actual ) . toInclude ( 'className={ax(["_bfhk5scu _syaz1q2z",__cmplp.className])}' ) ;
906
893
} ) ;
907
894
908
895
it ( 'should apply conditional CSS with object styles' , ( ) => {
@@ -915,11 +902,11 @@ describe('styled component behaviour', () => {
915
902
);
916
903
` ) ;
917
904
918
- expect ( actual ) . toIncludeMultiple ( [ '._syaz13q2{color:blue}' , '._syaz5scu{color:red}' ] ) ;
919
-
920
- expect ( actual ) . toInclude (
921
- 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}'
922
- ) ;
905
+ expect ( actual ) . toIncludeMultiple ( [
906
+ '._syaz13q2{color:blue}' ,
907
+ '._syaz5scu{color:red}' ,
908
+ 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}' ,
909
+ ] ) ;
923
910
} ) ;
924
911
925
912
it ( 'should apply conditional CSS with object styles and multiple props lines' , ( ) => {
@@ -937,11 +924,8 @@ describe('styled component behaviour', () => {
937
924
'._k48p8n31{font-weight:bold}' ,
938
925
'._syaz13q2{color:blue}' ,
939
926
'._syaz5scu{color:red}' ,
927
+ 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.isBolded&&"_k48p8n31",__cmplp.className])}' ,
940
928
] ) ;
941
-
942
- expect ( actual ) . toInclude (
943
- 'className={ax(["_syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.isBolded&&"_k48p8n31",__cmplp.className])}'
944
- ) ;
945
929
} ) ;
946
930
947
931
it ( 'should apply unconditional before and after a conditional css rule with object styles' , ( ) => {
@@ -955,15 +939,12 @@ describe('styled component behaviour', () => {
955
939
);
956
940
` ) ;
957
941
958
- expect . toIncludeMultiple ( [
942
+ expect ( actual ) . toIncludeMultiple ( [
959
943
'._syaz13q2{color:blue}' ,
960
944
'._19it97hw{border:1px solid black}' ,
961
945
'._syaz5scu{color:red}' ,
946
+ '{ax(["_19it97hw _syaz5scu",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}' ,
962
947
] ) ;
963
-
964
- expect ( actual ) . toInclude (
965
- '{ax(["_syaz5scu _19it97hw",__cmplp.isPrimary&&"_syaz13q2",__cmplp.className])}'
966
- ) ;
967
948
} ) ;
968
949
969
950
it ( 'should apply conditional CSS with object styles regardless declaration order' , ( ) => {
@@ -976,11 +957,12 @@ describe('styled component behaviour', () => {
976
957
);
977
958
` ) ;
978
959
979
- expect ( actual ) . toIncludeMultiple ( [ '._syaz5scu{color:red}' , '._syaz13q2{color:blue}' ] ) ;
960
+ expect ( actual ) . toIncludeMultiple ( [
961
+ '._syaz5scu{color:red}' ,
962
+ '._syaz13q2{color:blue}' ,
980
963
981
- expect ( actual ) . toInclude (
982
- 'className={ax(["_syaz13q2",__cmplp.isPrimary&&"_syaz5scu",__cmplp.className])}'
983
- ) ;
964
+ 'className={ax(["_syaz13q2",__cmplp.isPrimary&&"_syaz5scu",__cmplp.className])}' ,
965
+ ] ) ;
984
966
} ) ;
985
967
986
968
it ( 'should apply multi conditional logical expression' , ( ) => {
@@ -993,11 +975,11 @@ describe('styled component behaviour', () => {
993
975
);
994
976
` ) ;
995
977
996
- expect ( actual ) . toIncludeMultiple ( [ '._syaz13q2{color:blue}' , '._syaz5scu{color:red}' ] ) ;
997
-
998
- expect ( actual ) . toInclude (
999
- '{ax(["_syaz5scu",(__cmplp.isPrimary||__cmplp.isMaybe)&&"_syaz13q2",__cmplp.className])}'
1000
- ) ;
978
+ expect ( actual ) . toIncludeMultiple ( [
979
+ '._syaz13q2{color:blue}' ,
980
+ '._syaz5scu{color:red}' ,
981
+ '{ax(["_syaz5scu",(__cmplp.isPrimary||__cmplp.isMaybe)&&"_syaz13q2",__cmplp.className])}' ,
982
+ ] ) ;
1001
983
} ) ;
1002
984
1003
985
it ( 'should apply multi conditional logical expression with different props lines and syntax styles' , ( ) => {
@@ -1030,11 +1012,11 @@ describe('styled component behaviour', () => {
1030
1012
);
1031
1013
` ) ;
1032
1014
1033
- expect ( actual ) . toIncludeMultiple ( [ '._syaz13q2{color:blue}' , '._syaz5scu{color:red}' ] ) ;
1034
-
1035
- expect ( actual ) . toInclude (
1036
- '{ax(["_syaz5scu",__cmplp.isPrimary&&(__cmplp.isBolded||__cmplp.isFoo)&&"_syaz13q2",__cmplp.className])}'
1037
- ) ;
1015
+ expect ( actual ) . toIncludeMultiple ( [
1016
+ '._syaz13q2{color:blue}' ,
1017
+ '._syaz5scu{color:red}' ,
1018
+ '{ax(["_syaz5scu",__cmplp.isPrimary&&(__cmplp.isBolded||__cmplp.isFoo)&&"_syaz13q2",__cmplp.className])}' ,
1019
+ ] ) ;
1038
1020
} ) ;
1039
1021
1040
1022
it ( 'should apply conditional CSS with ternary and boolean in the same line' , ( ) => {
@@ -1070,9 +1052,8 @@ describe('styled component behaviour', () => {
1070
1052
expect ( actual ) . toIncludeMultiple ( [
1071
1053
'._bfhk1x77{background-color:white}' ,
1072
1054
'._syazruxl{color:orange}' ,
1055
+ 'className={ax(["_bfhk1x77 _syazruxl",__cmplp.className])}' ,
1073
1056
] ) ;
1074
-
1075
- expect ( actual ) . toInclude ( 'className={ax(["_syazruxl _bfhk1x77",__cmplp.className])}' ) ;
1076
1057
} ) ;
1077
1058
1078
1059
it ( 'should only add falsy condition when truthy condition has no value' , ( ) => {
@@ -1087,7 +1068,7 @@ describe('styled component behaviour', () => {
1087
1068
expect ( actual ) . toIncludeMultiple ( [
1088
1069
'._syazbf54{color:green}' ,
1089
1070
'._bfhk11x8{background-color:black}' ,
1090
- 'className={ax(["",!__cmplp.isPrimary&&"_syazbf54 _bfhk11x8",__cmplp.className])}' ,
1071
+ 'className={ax(["",!__cmplp.isPrimary&&"_bfhk11x8 _syazbf54 ",__cmplp.className])}' ,
1091
1072
] ) ;
1092
1073
} ) ;
1093
1074
@@ -1103,7 +1084,7 @@ describe('styled component behaviour', () => {
1103
1084
expect ( actual ) . toIncludeMultiple ( [
1104
1085
'._syazbf54{color:green}' ,
1105
1086
'._bfhk11x8{background-color:black}' ,
1106
- 'className={ax(["",__cmplp.isPrimary&&"_syazbf54 _bfhk11x8",__cmplp.className])}' ,
1087
+ 'className={ax(["",__cmplp.isPrimary&&"_bfhk11x8 _syazbf54 ",__cmplp.className])}' ,
1107
1088
] ) ;
1108
1089
} ) ;
1109
1090
0 commit comments