@@ -276,6 +276,51 @@ const tests = [
276276 input : ":global .foo { animation: foo; animation-name: bar; }" ,
277277 expected : ".foo { animation: foo; animation-name: bar; }" ,
278278 } ,
279+ {
280+ name : "handle nested global" ,
281+ input : ":global .a:not(:global .b) {}" ,
282+ expected : ".a:not(.b) {}" ,
283+ } ,
284+ {
285+ name : "handle nested global #1" ,
286+ input : ":global .a:not(:global .b:not(:global .c)) {}" ,
287+ expected : ".a:not(.b:not(.c)) {}" ,
288+ } ,
289+ {
290+ name : "handle nested global #2" ,
291+ input : ":local .a:not(:not(:not(:global .c))) {}" ,
292+ expected : ":local(.a):not(:not(:not(.c))) {}" ,
293+ } ,
294+ {
295+ name : "handle nested global #3" ,
296+ input : ":global .a:not(:global .b, :global .c) {}" ,
297+ expected : ".a:not(.b, .c) {}" ,
298+ } ,
299+ {
300+ name : "handle nested global #4" ,
301+ input : ":local .a:not(:global .b, :local .c) {}" ,
302+ expected : ":local(.a):not(.b, :local(.c)) {}" ,
303+ } ,
304+ {
305+ name : "handle nested global #5" ,
306+ input : ":global .a:not(:local .b, :global .c) {}" ,
307+ expected : ".a:not(:local(.b), .c) {}" ,
308+ } ,
309+ {
310+ name : "handle nested global #6" ,
311+ input : ":global .a:not(.b, .c) {}" ,
312+ expected : ".a:not(.b, .c) {}" ,
313+ } ,
314+ {
315+ name : "handle nested global #7" ,
316+ input : ":local .a:not(.b, .c) {}" ,
317+ expected : ":local(.a):not(:local(.b), :local(.c)) {}" ,
318+ } ,
319+ {
320+ name : "handle nested global #8" ,
321+ input : ":global .a:not(:local .b, .c) {}" ,
322+ expected : ".a:not(:local(.b), :local(.c)) {}" ,
323+ } ,
279324 {
280325 name : "handle a complex animation rule" ,
281326 input :
@@ -739,6 +784,11 @@ const tests = [
739784 input : ":global(#) {}" ,
740785 error : / I n v a l i d c l a s s o r i d s e l e c t o r s y n t a x / ,
741786 } ,
787+ {
788+ name : "throw on invalid global class usage" ,
789+ input : ":global(.a:not(:global .b, :global .c)) {}" ,
790+ error : / A : g l o b a l i s n o t a l l o w e d i n s i d e o f a : g l o b a l / ,
791+ } ,
742792 /*
743793 Bug in postcss-selector-parser
744794 {
0 commit comments