@@ -27,6 +27,37 @@ test('basic arbitrary properties', () => {
27
27
} )
28
28
} )
29
29
30
+ test ( 'different arbitrary properties are picked up separately' , ( ) => {
31
+ let config = {
32
+ content : [
33
+ {
34
+ raw : html `<div class= "[foo:bar] [bar:baz]" > </ div> ` ,
35
+ } ,
36
+ ] ,
37
+ corePlugins : { preflight : false } ,
38
+ }
39
+
40
+ let input = css `
41
+ @tailwind base;
42
+ @tailwind components;
43
+ @tailwind utilities;
44
+ `
45
+
46
+ return run ( input , config ) . then ( ( result ) => {
47
+ expect ( result . css ) . toMatchFormattedCss ( css `
48
+ ${ defaults }
49
+
50
+ .\[foo\:bar \] {
51
+ foo : bar;
52
+ }
53
+
54
+ .\[bar\:baz \] {
55
+ bar : baz;
56
+ }
57
+ ` )
58
+ } )
59
+ } )
60
+
30
61
test ( 'arbitrary properties with modifiers' , ( ) => {
31
62
let config = {
32
63
content : [
@@ -296,6 +327,67 @@ test('invalid arbitrary property 2', () => {
296
327
} )
297
328
} )
298
329
330
+ test ( 'using fractional spacing values inside theme() function' , ( ) => {
331
+ let config = {
332
+ content : [
333
+ {
334
+ raw : html `<div
335
+ class= "[border:_calc(5vw_-_theme(spacing[2.5]))_double_theme('colors.fuchsia.700')]"
336
+ > </ div> ` ,
337
+ } ,
338
+ ] ,
339
+ corePlugins : { preflight : false } ,
340
+ }
341
+
342
+ let input = css `
343
+ @tailwind base;
344
+ @tailwind components;
345
+ @tailwind utilities;
346
+ `
347
+
348
+ return run ( input , config ) . then ( ( result ) => {
349
+ expect ( result . css ) . toMatchFormattedCss ( css `
350
+ ${ defaults }
351
+
352
+ .\[border\:_calc\(5vw_-_theme\(spacing\[2\.5\]\)\)_double_theme\(\'colors\.fuchsia\.700 \'\)\] {
353
+ border : calc (5vw - 0.625rem ) double # a21caf ;
354
+ }
355
+ ` )
356
+ } )
357
+ } )
358
+
359
+ test ( 'using multiple arbitrary props having fractional spacing values' , ( ) => {
360
+ let config = {
361
+ content : [
362
+ {
363
+ raw : html `<div
364
+ class= "[height:_calc(100vh_-_theme(spacing[2.5]))] [box-shadow:_0_calc(theme(spacing[0.5])_*_-1)_theme(colors.red.400)_inset]"
365
+ > </ div> ` ,
366
+ } ,
367
+ ] ,
368
+ corePlugins : { preflight : false } ,
369
+ }
370
+
371
+ let input = css `
372
+ @tailwind base;
373
+ @tailwind components;
374
+ @tailwind utilities;
375
+ `
376
+
377
+ return run ( input , config ) . then ( ( result ) => {
378
+ return expect ( result . css ) . toMatchFormattedCss ( css `
379
+ ${ defaults }
380
+
381
+ .\[height\:_calc\(100vh_-_theme\(spacing\[2\.5 \]\)\)\] {
382
+ height : calc (100vh - 0.625rem );
383
+ }
384
+ .\[box-shadow\:_0_calc\(theme\(spacing\[0\.5\]\)_\*_-1\)_theme\(colors\.red\.400\)_inset \] {
385
+ box-shadow : 0 calc (0.125rem * -1 ) # f87171 inset;
386
+ }
387
+ ` )
388
+ } )
389
+ } )
390
+
299
391
it ( 'should be possible to read theme values in arbitrary properties (without quotes)' , ( ) => {
300
392
let config = {
301
393
content : [ { raw : html `<div class= "[--a:theme(colors.blue.500)] [color:var(--a)]" > </ div> ` } ] ,
0 commit comments