diff --git a/src/components/select/option.vue b/src/components/select/option.vue index 8dc2308144..0863097c73 100644 --- a/src/components/select/option.vue +++ b/src/components/select/option.vue @@ -66,7 +66,7 @@ }, // 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865 updateSearchLabel () { - this.searchLabel = this.$el.innerHTML; + this.searchLabel = this.$el.textContent; } }, mounted () { diff --git a/test/unit/specs/select.spec.js b/test/unit/specs/select.spec.js index 77daf0d629..cced6e6c6c 100644 --- a/test/unit/specs/select.spec.js +++ b/test/unit/specs/select.spec.js @@ -77,6 +77,27 @@ describe('Select.vue', () => { }); }); + it('should display normal characters in input when in filterable mode', done => { + vm = createVue({ + template: ` + + `, + data() { + return { + value: 2, + options: [{value: 1, label: '> 100$'}, {value: 2, label: '< 100$'}] + }; + } + }); + vm.$nextTick(() => { + const input = vm.$el.querySelector('.ivu-select-input'); + expect(input.value).to.equal('< 100$'); + done(); + }); + }); + it('should use the value\'s label instead of placeholder when both are set', done => { vm = createVue({ template: `