@@ -344,3 +344,188 @@ defineTest({
344
344
} )
345
345
} ,
346
346
} )
347
+
348
+ defineTest ( {
349
+ name : 'v4, using local, with explicit CSS entrypoints' ,
350
+ fs : {
351
+ 'package.json' : json `
352
+ {
353
+ "dependencies": {
354
+ "tailwindcss": "4.0.1"
355
+ }
356
+ }
357
+ ` ,
358
+ 'a/app.css' : css `
359
+ @import 'tailwindcss';
360
+ @theme {
361
+ --color-primary: #000000;
362
+ }
363
+ ` ,
364
+ 'b/app.css' : css `
365
+ @import 'tailwindcss';
366
+ @theme {
367
+ --color-primary: #ffffff;
368
+ }
369
+ ` ,
370
+ } ,
371
+ prepare : async ( { root } ) => ( { c : await init ( root ) } ) ,
372
+ handle : async ( { c } ) => {
373
+ await c . updateSettings ( {
374
+ tailwindCSS : {
375
+ experimental : {
376
+ configFile : {
377
+ 'a/app.css' : 'c/a/**' ,
378
+ 'b/app.css' : 'c/b/**' ,
379
+ } ,
380
+ } ,
381
+ } ,
382
+ } )
383
+
384
+ let documentA = await c . openDocument ( {
385
+ lang : 'html' ,
386
+ text : '<div class="bg-primary">' ,
387
+ name : 'c/a/index.html' ,
388
+ } )
389
+
390
+ let documentB = await c . openDocument ( {
391
+ lang : 'html' ,
392
+ text : '<div class="bg-primary">' ,
393
+ name : 'c/b/index.html' ,
394
+ } )
395
+
396
+ let hoverA = await c . sendRequest ( HoverRequest . type , {
397
+ textDocument : documentA ,
398
+
399
+ // <div class="bg-primary">
400
+ // ^
401
+ position : { line : 0 , character : 13 } ,
402
+ } )
403
+
404
+ let hoverB = await c . sendRequest ( HoverRequest . type , {
405
+ textDocument : documentB ,
406
+
407
+ // <div class="bg-primary">
408
+ // ^
409
+ position : { line : 0 , character : 13 } ,
410
+ } )
411
+
412
+ expect ( hoverA ) . toEqual ( {
413
+ contents : {
414
+ language : 'css' ,
415
+ value : dedent `
416
+ .bg-primary {
417
+ background-color: var(--color-primary) /* #000000 */;
418
+ }
419
+ ` ,
420
+ } ,
421
+ range : {
422
+ start : { line : 0 , character : 12 } ,
423
+ end : { line : 0 , character : 22 } ,
424
+ } ,
425
+ } )
426
+
427
+ expect ( hoverB ) . toEqual ( {
428
+ contents : {
429
+ language : 'css' ,
430
+ value : dedent `
431
+ .bg-primary {
432
+ background-color: var(--color-primary) /* #ffffff */;
433
+ }
434
+ ` ,
435
+ } ,
436
+ range : {
437
+ start : { line : 0 , character : 12 } ,
438
+ end : { line : 0 , character : 22 } ,
439
+ } ,
440
+ } )
441
+ } ,
442
+ } )
443
+
444
+ defineTest ( {
445
+ name : 'v4, using fallback, with explicit CSS entrypoints' ,
446
+ fs : {
447
+ 'a/app.css' : css `
448
+ @import 'tailwindcss';
449
+ @theme {
450
+ --color-primary: #000000;
451
+ }
452
+ ` ,
453
+ 'b/app.css' : css `
454
+ @import 'tailwindcss';
455
+ @theme {
456
+ --color-primary: #ffffff;
457
+ }
458
+ ` ,
459
+ } ,
460
+ prepare : async ( { root } ) => ( { c : await init ( root ) } ) ,
461
+ handle : async ( { c } ) => {
462
+ await c . updateSettings ( {
463
+ tailwindCSS : {
464
+ experimental : {
465
+ configFile : {
466
+ 'a/app.css' : 'c/a/**' ,
467
+ 'b/app.css' : 'c/b/**' ,
468
+ } ,
469
+ } ,
470
+ } ,
471
+ } )
472
+
473
+ let documentA = await c . openDocument ( {
474
+ lang : 'html' ,
475
+ text : '<div class="bg-primary">' ,
476
+ name : 'c/a/index.html' ,
477
+ } )
478
+
479
+ let documentB = await c . openDocument ( {
480
+ lang : 'html' ,
481
+ text : '<div class="bg-primary">' ,
482
+ name : 'c/b/index.html' ,
483
+ } )
484
+
485
+ let hoverA = await c . sendRequest ( HoverRequest . type , {
486
+ textDocument : documentA ,
487
+
488
+ // <div class="bg-primary">
489
+ // ^
490
+ position : { line : 0 , character : 13 } ,
491
+ } )
492
+
493
+ let hoverB = await c . sendRequest ( HoverRequest . type , {
494
+ textDocument : documentB ,
495
+
496
+ // <div class="bg-primary">
497
+ // ^
498
+ position : { line : 0 , character : 13 } ,
499
+ } )
500
+
501
+ expect ( hoverA ) . toEqual ( {
502
+ contents : {
503
+ language : 'css' ,
504
+ value : dedent `
505
+ .bg-primary {
506
+ background-color: var(--color-primary) /* #000000 */;
507
+ }
508
+ ` ,
509
+ } ,
510
+ range : {
511
+ start : { line : 0 , character : 12 } ,
512
+ end : { line : 0 , character : 22 } ,
513
+ } ,
514
+ } )
515
+
516
+ expect ( hoverB ) . toEqual ( {
517
+ contents : {
518
+ language : 'css' ,
519
+ value : dedent `
520
+ .bg-primary {
521
+ background-color: var(--color-primary) /* #ffffff */;
522
+ }
523
+ ` ,
524
+ } ,
525
+ range : {
526
+ start : { line : 0 , character : 12 } ,
527
+ end : { line : 0 , character : 22 } ,
528
+ } ,
529
+ } )
530
+ } ,
531
+ } )
0 commit comments