@@ -44,24 +44,24 @@ it('should support arbitrary values for various background utilities', () => {
4444 background-color: rgb(239 68 68 / var(--tw-bg-opacity));
4545 }
4646
47- .bg-\\[\\ #ff0000\ \] {
47+ .bg-\[\ #ff0000\] {
4848 --tw-bg-opacity: 1;
4949 background-color: rgb(255 0 0 / var(--tw-bg-opacity));
5050 }
5151
52- .bg-\\ [color\\ :var\\ (--bg-color\\)\ \] {
52+ .bg-\[color\:var\(--bg-color\) \] {
5353 background-color: var(--bg-color);
5454 }
5555
5656 .bg-gradient-to-r {
5757 background-image: linear-gradient(to right, var(--tw-gradient-stops));
5858 }
5959
60- .bg-\\ [url\\(\\'\\ /image-1-0\\ .png\\'\\)\ \] {
60+ .bg-\[url\(\'\ /image-1-0\.png\'\) \] {
6161 background-image: url('/image-1-0.png');
6262 }
6363
64- .bg-\\ [url\\ :var\\ (--image-url\\)\ \] {
64+ .bg-\[url\:var\(--image-url\) \] {
6565 background-image: var(--image-url);
6666 }
6767 ` )
@@ -86,15 +86,22 @@ it('should handle unknown typehints', () => {
8686 let config = { content : [ { raw : html `< div class ="w-[length:12px] "> </ div > ` } ] }
8787
8888 return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
89- return expect ( result . css ) . toMatchFormattedCss ( `
90- .w-\\ [length\\ :12px\ \] {
89+ return expect ( result . css ) . toMatchFormattedCss ( css `
90+ .w-\[length\:12px\] {
9191 width: 12px;
9292 }
9393 ` )
9494 } )
9595} )
9696
9797it ( 'should convert _ to spaces' , ( ) => {
98+ // Using custom css function here, because otherwise with String.raw, we run
99+ // into an issue with `\2c ` escapes. If we use `\2c ` then JS complains
100+ // about strict mode. But `\\2c ` is not what it expected.
101+ function css ( templates ) {
102+ return templates . join ( '' )
103+ }
104+
98105 let config = {
99106 content : [
100107 {
@@ -185,13 +192,13 @@ it('should convert _ to spaces', () => {
185192
186193it ( 'should not convert escaped underscores with spaces' , ( ) => {
187194 let config = {
188- content : [ { raw : html ` < div class ="content-['snake\\_case'] "> </ div > ` } ] ,
195+ content : [ { raw : ` <div class="content-['snake\\_case']"></div>` } ] ,
189196 corePlugins : { preflight : false } ,
190197 }
191198
192199 return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
193200 return expect ( result . css ) . toMatchFormattedCss ( css `
194- .content-\\[\\ 'snake\\\\ _case\\'\ \] {
201+ .content-\[\ 'snake\\_case\' \] {
195202 content: 'snake_case';
196203 }
197204 ` )
0 commit comments