@@ -611,4 +611,103 @@ const props = defineProps({ foo: String })
611
611
} ) . toThrow ( `cannot accept both type and non-type arguments` )
612
612
} )
613
613
} )
614
+
615
+ test ( 'should escape names w/ special symbols' , ( ) => {
616
+ const { content, bindings } = compile ( `
617
+ <script setup lang="ts">
618
+ defineProps<{
619
+ 'spa ce': unknown
620
+ 'exclamation!mark': unknown
621
+ 'double"quote': unknown
622
+ 'hash#tag': unknown
623
+ 'dollar$sign': unknown
624
+ 'percentage%sign': unknown
625
+ 'amper&sand': unknown
626
+ "single'quote": unknown
627
+ 'round(brack)ets': unknown
628
+ 'aste*risk': unknown
629
+ 'pl+us': unknown
630
+ 'com,ma': unknown
631
+ 'do.t': unknown
632
+ 'sla/sh': unknown
633
+ 'co:lon': unknown
634
+ 'semi;colon': unknown
635
+ 'angle<brack>ets': unknown
636
+ 'equal=sign': unknown
637
+ 'question?mark': unknown
638
+ 'at@sign': unknown
639
+ 'square[brack]ets': unknown
640
+ 'back\\\\slash': unknown
641
+ 'ca^ret': unknown
642
+ 'back\`tick': unknown
643
+ 'curly{bra}ces': unknown
644
+ 'pi|pe': unknown
645
+ 'til~de': unknown
646
+ 'da-sh': unknown
647
+ }>()
648
+ </script>` )
649
+ assertCode ( content )
650
+ expect ( content ) . toMatch ( `"spa ce": { type: null, required: true }` )
651
+ expect ( content ) . toMatch (
652
+ `"exclamation!mark": { type: null, required: true }`
653
+ )
654
+ expect ( content ) . toMatch ( `"double\\"quote": { type: null, required: true }` )
655
+ expect ( content ) . toMatch ( `"hash#tag": { type: null, required: true }` )
656
+ expect ( content ) . toMatch ( `"dollar$sign": { type: null, required: true }` )
657
+ expect ( content ) . toMatch ( `"percentage%sign": { type: null, required: true }` )
658
+ expect ( content ) . toMatch ( `"amper&sand": { type: null, required: true }` )
659
+ expect ( content ) . toMatch ( `"single'quote": { type: null, required: true }` )
660
+ expect ( content ) . toMatch ( `"round(brack)ets": { type: null, required: true }` )
661
+ expect ( content ) . toMatch ( `"aste*risk": { type: null, required: true }` )
662
+ expect ( content ) . toMatch ( `"pl+us": { type: null, required: true }` )
663
+ expect ( content ) . toMatch ( `"com,ma": { type: null, required: true }` )
664
+ expect ( content ) . toMatch ( `"do.t": { type: null, required: true }` )
665
+ expect ( content ) . toMatch ( `"sla/sh": { type: null, required: true }` )
666
+ expect ( content ) . toMatch ( `"co:lon": { type: null, required: true }` )
667
+ expect ( content ) . toMatch ( `"semi;colon": { type: null, required: true }` )
668
+ expect ( content ) . toMatch ( `"angle<brack>ets": { type: null, required: true }` )
669
+ expect ( content ) . toMatch ( `"equal=sign": { type: null, required: true }` )
670
+ expect ( content ) . toMatch ( `"question?mark": { type: null, required: true }` )
671
+ expect ( content ) . toMatch ( `"at@sign": { type: null, required: true }` )
672
+ expect ( content ) . toMatch (
673
+ `"square[brack]ets": { type: null, required: true }`
674
+ )
675
+ expect ( content ) . toMatch ( `"back\\\\slash": { type: null, required: true }` )
676
+ expect ( content ) . toMatch ( `"ca^ret": { type: null, required: true }` )
677
+ expect ( content ) . toMatch ( `"back\`tick": { type: null, required: true }` )
678
+ expect ( content ) . toMatch ( `"curly{bra}ces": { type: null, required: true }` )
679
+ expect ( content ) . toMatch ( `"pi|pe": { type: null, required: true }` )
680
+ expect ( content ) . toMatch ( `"til~de": { type: null, required: true }` )
681
+ expect ( content ) . toMatch ( `"da-sh": { type: null, required: true }` )
682
+ expect ( bindings ) . toStrictEqual ( {
683
+ 'spa ce' : BindingTypes . PROPS ,
684
+ 'exclamation!mark' : BindingTypes . PROPS ,
685
+ 'double"quote' : BindingTypes . PROPS ,
686
+ 'hash#tag' : BindingTypes . PROPS ,
687
+ dollar$sign : BindingTypes . PROPS ,
688
+ 'percentage%sign' : BindingTypes . PROPS ,
689
+ 'amper&sand' : BindingTypes . PROPS ,
690
+ "single'quote" : BindingTypes . PROPS ,
691
+ 'round(brack)ets' : BindingTypes . PROPS ,
692
+ 'aste*risk' : BindingTypes . PROPS ,
693
+ 'pl+us' : BindingTypes . PROPS ,
694
+ 'com,ma' : BindingTypes . PROPS ,
695
+ 'do.t' : BindingTypes . PROPS ,
696
+ 'sla/sh' : BindingTypes . PROPS ,
697
+ 'co:lon' : BindingTypes . PROPS ,
698
+ 'semi;colon' : BindingTypes . PROPS ,
699
+ 'angle<brack>ets' : BindingTypes . PROPS ,
700
+ 'equal=sign' : BindingTypes . PROPS ,
701
+ 'question?mark' : BindingTypes . PROPS ,
702
+ 'at@sign' : BindingTypes . PROPS ,
703
+ 'square[brack]ets' : BindingTypes . PROPS ,
704
+ 'back\\slash' : BindingTypes . PROPS ,
705
+ 'ca^ret' : BindingTypes . PROPS ,
706
+ 'back`tick' : BindingTypes . PROPS ,
707
+ 'curly{bra}ces' : BindingTypes . PROPS ,
708
+ 'pi|pe' : BindingTypes . PROPS ,
709
+ 'til~de' : BindingTypes . PROPS ,
710
+ 'da-sh' : BindingTypes . PROPS
711
+ } )
712
+ } )
614
713
} )
0 commit comments