File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
test/unit/features/directives Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -445,4 +445,30 @@ describe('Directive v-model select', () => {
445445 done ( )
446446 } , 0 )
447447 } )
448+
449+ it ( 'should work with option value that has circular reference' , done => {
450+ const circular = { }
451+ circular . self = circular
452+
453+ const vm = new Vue ( {
454+ data : {
455+ test : 'b' ,
456+ circular
457+ } ,
458+ template :
459+ '<select v-model="test">' +
460+ '<option :value="circular">a</option>' +
461+ '<option>b</option>' +
462+ '<option>c</option>' +
463+ '</select>'
464+ } ) . $mount ( )
465+ document . body . appendChild ( vm . $el )
466+ expect ( vm . test ) . toBe ( 'b' )
467+ expect ( vm . $el . value ) . toBe ( 'b' )
468+ expect ( vm . $el . childNodes [ 1 ] . selected ) . toBe ( true )
469+ vm . test = circular
470+ waitForUpdate ( function ( ) {
471+ expect ( vm . $el . childNodes [ 0 ] . selected ) . toBe ( true )
472+ } ) . then ( done )
473+ } )
448474} )
You can’t perform that action at this time.
0 commit comments