@@ -876,6 +876,147 @@ const tests = [
876
876
options : { mode : "pure" } ,
877
877
error : / i s n o t p u r e / ,
878
878
} ,
879
+ {
880
+ name : "should suppress errors for global selectors after ignore comment" ,
881
+ options : { mode : "pure" } ,
882
+ input : `/* cssmodules-pure-ignore */
883
+ :global(.foo) { color: blue; }` ,
884
+ expected : `/* cssmodules-pure-ignore */
885
+ .foo { color: blue; }` ,
886
+ } ,
887
+ {
888
+ name : "should allow additional text in ignore comment" ,
889
+ options : { mode : "pure" } ,
890
+ input : `/* cssmodules-pure-ignore - needed for third party integration */
891
+ :global(#foo) { color: blue; }` ,
892
+ expected : `/* cssmodules-pure-ignore - needed for third party integration */
893
+ #foo { color: blue; }` ,
894
+ } ,
895
+ {
896
+ name : "should not affect rules after the ignored block" ,
897
+ options : { mode : "pure" } ,
898
+ input : `/* cssmodules-pure-ignore */
899
+ :global(.foo) { color: blue; }
900
+ :global(.bar) { color: red; }` ,
901
+ error : / i s n o t p u r e / ,
902
+ } ,
903
+ {
904
+ name : "should work with nested global selectors in ignored block" ,
905
+ options : { mode : "pure" } ,
906
+ input : `/* cssmodules-pure-ignore */
907
+ :global(.foo) {
908
+ :global(.bar) { color: blue; }
909
+ }` ,
910
+ error : / i s n o t p u r e / ,
911
+ } ,
912
+ {
913
+ name : "should work with ignored nested global selectors in ignored block" ,
914
+ options : { mode : "pure" } ,
915
+ input : `/* cssmodules-pure-ignore */
916
+ :global(.foo) {
917
+ /* cssmodules-pure-ignore */
918
+ :global(.bar) { color: blue; }
919
+ }` ,
920
+ expected : `/* cssmodules-pure-ignore */
921
+ .foo {
922
+ /* cssmodules-pure-ignore */
923
+ .bar { color: blue; }
924
+ }` ,
925
+ } ,
926
+ {
927
+ name : "should work with view transitions in ignored block" ,
928
+ options : { mode : "pure" } ,
929
+ input : `/* cssmodules-pure-ignore */
930
+ ::view-transition-group(modal) {
931
+ animation-duration: 300ms;
932
+ }` ,
933
+ expected : `/* cssmodules-pure-ignore */
934
+ ::view-transition-group(modal) {
935
+ animation-duration: 300ms;
936
+ }` ,
937
+ } ,
938
+ {
939
+ name : "should work with keyframes in ignored block" ,
940
+ options : { mode : "pure" } ,
941
+ input : `/* cssmodules-pure-ignore */
942
+ @keyframes :global(fadeOut) {
943
+ from { opacity: 1; }
944
+ to { opacity: 0; }
945
+ }` ,
946
+ expected : `/* cssmodules-pure-ignore */
947
+ @keyframes fadeOut {
948
+ from { opacity: 1; }
949
+ to { opacity: 0; }
950
+ }` ,
951
+ } ,
952
+ {
953
+ name : "should work in media queries" ,
954
+ options : { mode : "pure" } ,
955
+ input : `@media (min-width: 768px) {
956
+ /* cssmodules-pure-ignore */
957
+ :global(.foo) { color: blue; }
958
+ }` ,
959
+ expected : `@media (min-width: 768px) {
960
+ /* cssmodules-pure-ignore */
961
+ .foo { color: blue; }
962
+ }` ,
963
+ } ,
964
+ {
965
+ name : "should handle multiple ignore comments" ,
966
+ options : { mode : "pure" } ,
967
+ input : `/* cssmodules-pure-ignore */
968
+ :global(.foo) { color: blue; }
969
+ .local { color: green; }
970
+ /* cssmodules-pure-ignore */
971
+ :global(.bar) { color: red; }` ,
972
+ expected : `/* cssmodules-pure-ignore */
973
+ .foo { color: blue; }
974
+ :local(.local) { color: green; }
975
+ /* cssmodules-pure-ignore */
976
+ .bar { color: red; }` ,
977
+ } ,
978
+ {
979
+ name : "should work with complex selectors in ignored block" ,
980
+ options : { mode : "pure" } ,
981
+ input : `/* cssmodules-pure-ignore */
982
+ :global(.foo):hover > :global(.bar) + :global(.baz) {
983
+ color: blue;
984
+ }` ,
985
+ expected : `/* cssmodules-pure-ignore */
986
+ .foo:hover > .bar + .baz {
987
+ color: blue;
988
+ }` ,
989
+ } ,
990
+ {
991
+ name : "should work with multiple selectors in ignored block" ,
992
+ options : { mode : "pure" } ,
993
+ input : `/* cssmodules-pure-ignore */
994
+ :global(.foo),
995
+ :global(.bar),
996
+ :global(.baz) {
997
+ color: blue;
998
+ }` ,
999
+ expected : `/* cssmodules-pure-ignore */
1000
+ .foo,
1001
+ .bar,
1002
+ .baz {
1003
+ color: blue;
1004
+ }` ,
1005
+ } ,
1006
+ {
1007
+ name : "should work with pseudo-elements in ignored block" ,
1008
+ options : { mode : "pure" } ,
1009
+ input : `/* cssmodules-pure-ignore */
1010
+ :global(.foo)::before,
1011
+ :global(.foo)::after {
1012
+ content: '';
1013
+ }` ,
1014
+ expected : `/* cssmodules-pure-ignore */
1015
+ .foo::before,
1016
+ .foo::after {
1017
+ content: '';
1018
+ }` ,
1019
+ } ,
879
1020
{
880
1021
name : "css nesting" ,
881
1022
input : `
0 commit comments