mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
- fix Vue 2 peer dependency
- fix typo in readme - add test coverage for focus/blur events
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
#### Features
|
#### Features
|
||||||
- AJAX Support
|
- AJAX Support
|
||||||
- Tagging
|
- Tagging
|
||||||
- No JS Dependenciesp
|
|
||||||
- List Filtering/Searching
|
- List Filtering/Searching
|
||||||
- Supports Vuex
|
- Supports Vuex
|
||||||
- Select Single/Multiple Options
|
- Select Single/Multiple Options
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
"url": "https://github.com/sagalbot/vue-select.git"
|
"url": "https://github.com/sagalbot/vue-select.git"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "~1.0"
|
"vue": "2.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.0.0",
|
"babel-core": "^6.0.0",
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ describe('Select.vue', () => {
|
|||||||
}).$mount()
|
}).$mount()
|
||||||
vm.$children[0].select('foo')
|
vm.$children[0].select('foo')
|
||||||
expect(vm.$children[0].mutableValue.length).toEqual(1)
|
expect(vm.$children[0].mutableValue.length).toEqual(1)
|
||||||
|
}),
|
||||||
|
|
||||||
|
it('can deselect an option when multiple is false', () => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: `<div><v-select :value="'foo'"></v-select></div>`,
|
||||||
|
}).$mount()
|
||||||
|
vm.$children[0].deselect('foo')
|
||||||
|
expect(vm.$children[0].mutableValue).toEqual(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can determine if the value prop is empty', () => {
|
it('can determine if the value prop is empty', () => {
|
||||||
@@ -232,7 +240,14 @@ describe('Select.vue', () => {
|
|||||||
expect(vm.value).toEqual('bar')
|
expect(vm.value).toEqual('bar')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
}),
|
||||||
|
|
||||||
|
it('can check if a string value is selected when the value is an object and multiple is true', () => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: `<div><v-select multiple :value="[{label: 'foo', value: 'bar'}]"></v-select></div>`,
|
||||||
|
}).$mount()
|
||||||
|
expect(vm.$children[0].isOptionSelected('foo')).toEqual(true)
|
||||||
|
}),
|
||||||
|
|
||||||
describe('change Event', () => {
|
describe('change Event', () => {
|
||||||
it('will trigger the input event when the selection changes', (done) => {
|
it('will trigger the input event when the selection changes', (done) => {
|
||||||
@@ -351,6 +366,31 @@ describe('Select.vue', () => {
|
|||||||
expect(vm.$children[0].open).toEqual(true)
|
expect(vm.$children[0].open).toEqual(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('will close the dropdown and emit the search:blur event from onSearchBlur', () => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: '<div><v-select></v-select></div>',
|
||||||
|
}).$mount()
|
||||||
|
|
||||||
|
spyOn(vm.$children[0], '$emit')
|
||||||
|
vm.$children[0].open = true
|
||||||
|
vm.$children[0].onSearchBlur()
|
||||||
|
|
||||||
|
expect(vm.$children[0].open).toEqual(false)
|
||||||
|
expect(vm.$children[0].$emit).toHaveBeenCalledWith('search:blur')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('will open the dropdown and emit the search:focus event from onSearchFocus', () => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: '<div><v-select></v-select></div>',
|
||||||
|
}).$mount()
|
||||||
|
|
||||||
|
spyOn(vm.$children[0], '$emit')
|
||||||
|
vm.$children[0].onSearchFocus()
|
||||||
|
|
||||||
|
expect(vm.$children[0].open).toEqual(true)
|
||||||
|
expect(vm.$children[0].$emit).toHaveBeenCalledWith('search:focus')
|
||||||
|
})
|
||||||
|
|
||||||
it('will close the dropdown on escape, if search is empty', (done) => {
|
it('will close the dropdown on escape, if search is empty', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select></v-select></div>',
|
template: '<div><v-select></v-select></div>',
|
||||||
|
|||||||
Reference in New Issue
Block a user