Browse Source

test v-model select with circular reference

dev
Evan You 8 years ago
parent
commit
95cd2bd7fa
  1. 26
      test/unit/features/directives/model-select.spec.js

26
test/unit/features/directives/model-select.spec.js

@ -445,4 +445,30 @@ describe('Directive v-model select', () => {
done()
}, 0)
})
it('should work with option value that has circular reference', done => {
const circular = {}
circular.self = circular
const vm = new Vue({
data: {
test: 'b',
circular
},
template:
'<select v-model="test">' +
'<option :value="circular">a</option>' +
'<option>b</option>' +
'<option>c</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.test).toBe('b')
expect(vm.$el.value).toBe('b')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = circular
waitForUpdate(function () {
expect(vm.$el.childNodes[0].selected).toBe(true)
}).then(done)
})
})

Loading…
Cancel
Save