2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-16 09:10:33 +03:00

Merge pull request #171 from fidgetwidget/non-multiple-improvements

Added features to non multiple selects
This commit is contained in:
Jeff
2017-04-24 11:23:34 -07:00
committed by GitHub
3 changed files with 81 additions and 0 deletions
+43
View File
@@ -1144,4 +1144,47 @@ describe('Select.vue', () => {
})
})
})
describe('Single value options', () => {
it('should reset the search input on focus lost', (done) => {
const vm = new Vue({
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
data: {
value: 'one',
options: ['one', 'two', 'three']
}
}).$mount()
vm.$children[0].open = true
vm.$refs.select.search = "t"
expect(vm.$refs.select.search).toEqual('t')
vm.$children[0].onSearchBlur()
Vue.nextTick(() => {
expect(vm.$refs.select.search).toEqual('')
done()
})
})
it ('should not reset the search input on focus lost when clearSearchOnSelect is false', (done) => {
const vm = new Vue({
template: '<div><v-select ref="select" :options="options" :value="value" :clear-search-on-select="false"></v-select></div>',
data: {
value: 'one',
options: ['one', 'two', 'three']
}
}).$mount()
expect(vm.$refs.select.clearSearchOnSelect).toEqual(false)
vm.$children[0].open = true
vm.$refs.select.search = "t"
expect(vm.$refs.select.search).toEqual('t')
vm.$children[0].onSearchBlur()
Vue.nextTick(() => {
expect(vm.$refs.select.search).toEqual('t')
done()
})
})
})
})