Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73d2b3f

Browse filesBrowse files
committed
fix: do not emit update:value in case of 'multiple' attribute coreui#64
1 parent 67f7cef commit 73d2b3f
Copy full SHA for 73d2b3f

File tree

2 files changed

+15
-0
lines changed
Filter options

2 files changed

+15
-0
lines changed

‎src/components/form/CSelect.vue

Copy file name to clipboardExpand all lines: src/components/form/CSelect.vue
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export default {
220220
221221
methods: {
222222
onSelect (e) {
223+
if (this.$attrs.multiple !== undefined) return
223224
const optionIndex = e.target.selectedOptions[0].dataset.key
224225
const option = this.options[optionIndex]
225226
const value = option.value || option

‎src/components/form/tests/CSelect.spec.js

Copy file name to clipboardExpand all lines: src/components/form/tests/CSelect.spec.js
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ const customWrapper = mount(Component, {
4242
prepend: 'prepended'
4343
}
4444
})
45+
const wrapperMultiple = mount(Component, {
46+
propsData: {
47+
options: ['Option 1', 'Option 2', 'Option 3'],
48+
},
49+
attrs: {
50+
multiple: true
51+
}
52+
})
4553

4654
describe(ComponentName, () => {
4755
it('has a name', () => {
@@ -62,4 +70,10 @@ describe(ComponentName, () => {
6270
select.trigger('input')
6371
expect(customWrapper.emitted()['update:value']).toBeTruthy()
6472
})
73+
it('not emit update event on multiple select', () => {
74+
const select = wrapperMultiple.find('select')
75+
select.element.value = 'Option 2'
76+
select.trigger('input')
77+
expect(wrapperMultiple.emitted()['update:value']).not.toBeTruthy()
78+
})
6579
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.