diff --git a/dev.html b/dev.html
index bc01d7a..5e9f51d 100644
--- a/dev.html
+++ b/dev.html
@@ -34,7 +34,8 @@
-
+
+
diff --git a/src/components/Select.vue b/src/components/Select.vue
index ef65e60..5c3e4a5 100644
--- a/src/components/Select.vue
+++ b/src/components/Select.vue
@@ -391,13 +391,13 @@
},
/**
- * Allows user to choose to close the select dropdown when an option is selected.
- * set to true when multiple=true to close the dropdown between each selection
+ * Close a dropdown when an option is select. Set to false to keep the dropdown
+ * open (useful when combined with multi-select, for example)
* @type {Boolean}
*/
- closeOnMultiSelect: {
+ closeOnSelect: {
type: Boolean,
- default: false
+ default: true
},
/**
@@ -635,12 +635,7 @@
* @return {void}
*/
onAfterSelect(option) {
- if (this.multiple) {
- if (this.closeOnMultiSelect) {
- this.open = !this.open
- this.$refs.search.blur()
- }
- } else {
+ if (this.closeOnSelect) {
this.open = !this.open
this.$refs.search.blur()
}
diff --git a/test/unit/specs/Select.spec.js b/test/unit/specs/Select.spec.js
index 65f7421..ba98bf5 100644
--- a/test/unit/specs/Select.spec.js
+++ b/test/unit/specs/Select.spec.js
@@ -351,9 +351,10 @@ describe('Select.vue', () => {
})
})
- it('can close the dropdown when the el is clicked, multiple is true, and multipleCloseOnSelect option is true', (done) => {
+
+ it('closes the dropdown when an option is selected, multiple is true, and closeOnSelect option is true', (done) => {
const vm = new Vue({
- template: '
',
+ template: '
',
components: {vSelect},
data: {
value: [],
@@ -370,6 +371,25 @@ describe('Select.vue', () => {
})
})
+ it('does not close the dropdown when the el is clicked, multiple is true, and closeOnSelect option is false', (done) => {
+ const vm = new Vue({
+ template: '
',
+ components: {vSelect},
+ data: {
+ value: [],
+ options: ['one', 'two', 'three']
+ }
+ }).$mount()
+
+ vm.$children[0].open = true
+ vm.$refs.select.select('one')
+
+ Vue.nextTick(() => {
+ expect(vm.$children[0].open).toEqual(true)
+ done()
+ })
+ })
+
it('should close the dropdown on search blur', () => {
const vm = new Vue({