@@ -11,7 +11,8 @@ import {
11
11
Position ,
12
12
TextNode ,
13
13
InterpolationNode ,
14
- ConstantTypes
14
+ ConstantTypes ,
15
+ DirectiveNode
15
16
} from '../src/ast'
16
17
17
18
describe ( 'compiler: parse' , ( ) => {
@@ -1164,6 +1165,34 @@ describe('compiler: parse', () => {
1164
1165
} )
1165
1166
} )
1166
1167
1168
+ // #3494
1169
+ test ( 'directive argument edge case' , ( ) => {
1170
+ const ast = baseParse ( '<div v-slot:slot />' )
1171
+ const directive = ( ast . children [ 0 ] as ElementNode )
1172
+ . props [ 0 ] as DirectiveNode
1173
+ expect ( directive . arg ) . toMatchObject ( {
1174
+ loc : {
1175
+ start : { offset : 12 , line : 1 , column : 13 } ,
1176
+ end : { offset : 16 , line : 1 , column : 17 } ,
1177
+ source : 'slot'
1178
+ }
1179
+ } )
1180
+ } )
1181
+
1182
+ // https://github.com/vuejs/language-tools/issues/2710
1183
+ test ( 'directive argument edge case (2)' , ( ) => {
1184
+ const ast = baseParse ( '<div #item.item />' )
1185
+ const directive = ( ast . children [ 0 ] as ElementNode )
1186
+ . props [ 0 ] as DirectiveNode
1187
+ expect ( directive . arg ) . toMatchObject ( {
1188
+ loc : {
1189
+ start : { offset : 6 , line : 1 , column : 7 } ,
1190
+ end : { offset : 15 , line : 1 , column : 16 } ,
1191
+ source : 'item.item'
1192
+ }
1193
+ } )
1194
+ } )
1195
+
1167
1196
test ( 'directive with dynamic argument' , ( ) => {
1168
1197
const ast = baseParse ( '<div v-on:[event]/>' )
1169
1198
const directive = ( ast . children [ 0 ] as ElementNode ) . props [ 0 ]
0 commit comments