File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
test/unit/features/directives Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ function checkIdentifier (
8080) {
8181 if ( typeof ident === 'string' ) {
8282 try {
83- new Function ( `var ${ ident } ` )
83+ new Function ( `var ${ ident } =_ ` )
8484 } catch ( e ) {
8585 errors . push ( `invalid ${ type } "${ ident } " in expression: ${ text . trim ( ) } ` )
8686 }
Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ describe('Directive v-for', () => {
446446 } ) . then ( done )
447447 } )
448448
449- it ( 'strings' , done => {
449+ it ( 'should work with strings' , done => {
450450 const vm = new Vue ( {
451451 data : {
452452 text : 'foo'
@@ -463,4 +463,21 @@ describe('Directive v-for', () => {
463463 expect ( vm . $el . textContent ) . toMatch ( 'f.o.o.b.a.r.' )
464464 } ) . then ( done )
465465 } )
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+ }
466483} )
You can’t perform that action at this time.
0 commit comments