File tree 2 files changed +55
-1
lines changed
2 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ function* buildRegExps(context) {
69
69
'((?=((' ,
70
70
regex . any (
71
71
[
72
- regex . pattern ( [ / ( [ ^ \s " ' ` \[ \\ ] + - ) ? \[ [ ^ \s " ' ` \\ ] + \] / , separator ] ) ,
72
+ regex . pattern ( [ / ( [ ^ \s " ' ` \[ \\ ] + - ) ? \[ [ ^ \s " ' ` ] + \] / , separator ] ) ,
73
73
regex . pattern ( [ / [ ^ \s " ' ` \[ \\ ] + / , separator ] ) ,
74
74
] ,
75
75
true
Original file line number Diff line number Diff line change @@ -405,3 +405,57 @@ test('with @apply', () => {
405
405
` )
406
406
} )
407
407
} )
408
+
409
+ test ( 'keeps escaped underscores' , ( ) => {
410
+ let config = {
411
+ content : [
412
+ {
413
+ raw : '<div class="[&_.foo\\_\\_bar]:underline"></div>' ,
414
+ } ,
415
+ ] ,
416
+ corePlugins : { preflight : false } ,
417
+ }
418
+
419
+ let input = `
420
+ @tailwind base;
421
+ @tailwind components;
422
+ @tailwind utilities;
423
+ `
424
+
425
+ return run ( input , config ) . then ( ( result ) => {
426
+ expect ( result . css ) . toMatchFormattedCss ( css `
427
+ ${ defaults }
428
+
429
+ .\[\&_\.foo\\_\\_bar\]\:underline .foo__bar {
430
+ text-decoration-line : underline;
431
+ }
432
+ ` )
433
+ } )
434
+ } )
435
+
436
+ test ( 'keeps escaped underscores with multiple arbitrary variants' , ( ) => {
437
+ let config = {
438
+ content : [
439
+ {
440
+ raw : '<div class="[&_.foo\\_\\_bar]:[&_.bar\\_\\_baz]:underline"></div>' ,
441
+ } ,
442
+ ] ,
443
+ corePlugins : { preflight : false } ,
444
+ }
445
+
446
+ let input = `
447
+ @tailwind base;
448
+ @tailwind components;
449
+ @tailwind utilities;
450
+ `
451
+
452
+ return run ( input , config ) . then ( ( result ) => {
453
+ expect ( result . css ) . toMatchFormattedCss ( css `
454
+ ${ defaults }
455
+
456
+ .\[\&_\.foo\\_\\_bar\]\:\[\&_\.bar\\_\\_baz\]\:underline .bar__baz .foo__bar {
457
+ text-decoration-line : underline;
458
+ }
459
+ ` )
460
+ } )
461
+ } )
You can’t perform that action at this time.
0 commit comments