Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/directives/model/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function checkInitialValue () {
}
}
}
if (initValue) {
if (typeof initValue !== 'undefined') {
this._initValue = this.number
? _.toNumber(initValue)
: initValue
Expand Down
10 changes: 10 additions & 0 deletions test/unit/specs/directives/model_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ if (_.inBrowser) {
expect(el.firstChild.childNodes[1].selected).toBe(true)
})

it('select + empty default value', function () {
var vm = new Vue({
el: el,
template: '<select v-model="test"><option value="" selected>null</option><<option value="1">1</option></select>'
})
expect(vm.test).toBe('')
trigger(vm.$el.firstChild, 'change')
expect(vm.test).toBe('')
})

it('select + multiple', function (done) {
var vm = new Vue({
el: el,
Expand Down