@@ -202,6 +202,16 @@ describe('compiler: v-for', () => {
202202 expect ( forNode . valueAlias ) . toBeUndefined ( )
203203 expect ( ( forNode . source as SimpleExpressionNode ) . content ) . toBe ( 'items' )
204204 } )
205+
206+ test ( 'source containing string expression with spaces' , ( ) => {
207+ const { node : forNode } = parseWithForTransform (
208+ `<span v-for="item in state ['my items']" />`
209+ )
210+ expect ( forNode . keyAlias ) . toBeUndefined ( )
211+ expect ( forNode . objectIndexAlias ) . toBeUndefined ( )
212+ expect ( ( forNode . valueAlias as SimpleExpressionNode ) . content ) . toBe ( 'item' )
213+ expect ( ( forNode . source as SimpleExpressionNode ) . content ) . toBe ( "state ['my items']" )
214+ } )
205215 } )
206216
207217 describe ( 'errors' , ( ) => {
@@ -265,16 +275,6 @@ describe('compiler: v-for', () => {
265275 )
266276 } )
267277
268- test ( 'source containing string expression with spaces' , ( ) => {
269- const { node : forNode } = parseWithForTransform (
270- `<span v-for="item in state ['my items']" />`
271- )
272- expect ( forNode . keyAlias ) . toBeUndefined ( )
273- expect ( forNode . objectIndexAlias ) . toBeUndefined ( )
274- expect ( ( forNode . valueAlias as SimpleExpressionNode ) . content ) . toBe ( 'item' )
275- expect ( ( forNode . source as SimpleExpressionNode ) . content ) . toBe ( "state ['my items']" )
276- } )
277-
278278 test ( 'missing value' , ( ) => {
279279 const onError = vi . fn ( )
280280 parseWithForTransform ( '<span v-for="in items" />' , { onError } )
0 commit comments