diff --git a/README.md b/README.md index 1cb57c2..f6580e1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ #### Features - AJAX Support - Tagging -- No JS Dependenciesp - List Filtering/Searching - Supports Vuex - Select Single/Multiple Options diff --git a/package.json b/package.json index fb9bdc8..6ad3f0d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "url": "https://github.com/sagalbot/vue-select.git" }, "peerDependencies": { - "vue": "~1.0" + "vue": "2.x" }, "devDependencies": { "babel-core": "^6.0.0", diff --git a/test/unit/specs/Select.spec.js b/test/unit/specs/Select.spec.js index 435a485..c236ea0 100644 --- a/test/unit/specs/Select.spec.js +++ b/test/unit/specs/Select.spec.js @@ -131,6 +131,14 @@ describe('Select.vue', () => { }).$mount() vm.$children[0].select('foo') expect(vm.$children[0].mutableValue.length).toEqual(1) + }), + + it('can deselect an option when multiple is false', () => { + const vm = new Vue({ + template: `
`, + }).$mount() + vm.$children[0].deselect('foo') + expect(vm.$children[0].mutableValue).toEqual(null) }) it('can determine if the value prop is empty', () => { @@ -232,7 +240,14 @@ describe('Select.vue', () => { expect(vm.value).toEqual('bar') 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: `
`, + }).$mount() + expect(vm.$children[0].isOptionSelected('foo')).toEqual(true) + }), describe('change Event', () => { 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) }) + it('will close the dropdown and emit the search:blur event from onSearchBlur', () => { + const vm = new Vue({ + template: '
', + }).$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: '
', + }).$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) => { const vm = new Vue({ template: '
',