File tree 2 files changed +19
-2
lines changed
test/unit/features/directives
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ function checkIdentifier (
80
80
) {
81
81
if ( typeof ident === 'string' ) {
82
82
try {
83
- new Function ( `var ${ ident } ` )
83
+ new Function ( `var ${ ident } =_ ` )
84
84
} catch ( e ) {
85
85
errors . push ( `invalid ${ type } "${ ident } " in expression: ${ text . trim ( ) } ` )
86
86
}
Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ describe('Directive v-for', () => {
446
446
} ) . then ( done )
447
447
} )
448
448
449
- it ( 'strings' , done => {
449
+ it ( 'should work with strings' , done => {
450
450
const vm = new Vue ( {
451
451
data : {
452
452
text : 'foo'
@@ -463,4 +463,21 @@ describe('Directive v-for', () => {
463
463
expect ( vm . $el . textContent ) . toMatch ( 'f.o.o.b.a.r.' )
464
464
} ) . then ( done )
465
465
} )
466
+
467
+ const supportsDeconstruct = ( ( ) => {
468
+ try {
469
+ new Function ( 'var { foo } = bar' )
470
+ return true
471
+ } catch ( e ) { }
472
+ } ) ( )
473
+
474
+ if ( supportsDeconstruct ) {
475
+ it ( 'should support deconstruct syntax in alias position' , ( ) => {
476
+ const vm = new Vue ( {
477
+ data : { list : [ { foo : 'hi' } ] } ,
478
+ template : '<div><div v-for="({ foo }, i) in list">{{ foo }}{{ i }}</div></div>'
479
+ } ) . $mount ( )
480
+ expect ( vm . $el . textContent ) . toBe ( 'hi0' )
481
+ } )
482
+ }
466
483
} )
You can’t perform that action at this time.
0 commit comments