@@ -740,6 +740,80 @@ defineTest({
740
740
} ,
741
741
} )
742
742
743
+ defineTest ( {
744
+ name : 'v4: Completions show after a variant arbitrary value, using prefixes' ,
745
+ fs : {
746
+ 'app.css' : css `
747
+ @import 'tailwindcss' prefix(tw);
748
+ ` ,
749
+ } ,
750
+ prepare : async ( { root } ) => ( { client : await createClient ( { root } ) } ) ,
751
+ handle : async ( { client } ) => {
752
+ let document = await client . open ( {
753
+ lang : 'html' ,
754
+ text : '<div class="tw:data-[foo]:">' ,
755
+ } )
756
+
757
+ // <div class="tw:data-[foo]:">
758
+ // ^
759
+ let completion = await document . completions ( { line : 0 , character : 26 } )
760
+
761
+ expect ( completion ?. items . length ) . toBe ( 19236 )
762
+ } ,
763
+ } )
764
+
765
+ defineTest ( {
766
+ name : 'v4: Variant and utility suggestions show prefix when one has been typed' ,
767
+ fs : {
768
+ 'app.css' : css `
769
+ @import 'tailwindcss' prefix(tw);
770
+ ` ,
771
+ } ,
772
+ prepare : async ( { root } ) => ( { client : await createClient ( { root } ) } ) ,
773
+ handle : async ( { client } ) => {
774
+ let document = await client . open ( {
775
+ lang : 'html' ,
776
+ text : '<div class="">' ,
777
+ } )
778
+
779
+ // <div class="">
780
+ // ^
781
+ let completion = await document . completions ( { line : 0 , character : 12 } )
782
+
783
+ expect ( completion ?. items . length ) . toBe ( 19237 )
784
+
785
+ // Verify that variants and utilities are all prefixed
786
+ let prefixed = completion . items . filter ( ( item ) => ! item . label . startsWith ( 'tw:' ) )
787
+ expect ( prefixed ) . toHaveLength ( 0 )
788
+ } ,
789
+ } )
790
+
791
+ defineTest ( {
792
+ name : 'v4: Variant and utility suggestions hide prefix when it has been typed' ,
793
+ fs : {
794
+ 'app.css' : css `
795
+ @import 'tailwindcss' prefix(tw);
796
+ ` ,
797
+ } ,
798
+ prepare : async ( { root } ) => ( { client : await createClient ( { root } ) } ) ,
799
+ handle : async ( { client } ) => {
800
+ let document = await client . open ( {
801
+ lang : 'html' ,
802
+ text : '<div class="tw:">' ,
803
+ } )
804
+
805
+ // <div class="tw:">
806
+ // ^
807
+ let completion = await document . completions ( { line : 0 , character : 15 } )
808
+
809
+ expect ( completion ?. items . length ) . toBe ( 19236 )
810
+
811
+ // Verify that no variants and utilities have prefixes
812
+ let prefixed = completion . items . filter ( ( item ) => item . label . startsWith ( 'tw:' ) )
813
+ expect ( prefixed ) . toHaveLength ( 0 )
814
+ } ,
815
+ } )
816
+
743
817
defineTest ( {
744
818
name : 'v4: Completions show inside class functions in JS/TS files' ,
745
819
fs : {
0 commit comments