Commit 252717e7c4c07ff3567a32fde408dd545677875f

Authored by Aresn
Committed by GitHub
2 parents 9147e636 dfae43a7

Merge pull request #2193 from SergioCrisostomo/fix-2191

correct input value in filterable mode
src/components/select/option.vue
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 }, 66 },
67 // 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865 67 // 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865
68 updateSearchLabel () { 68 updateSearchLabel () {
69 - this.searchLabel = this.$el.innerHTML; 69 + this.searchLabel = this.$el.textContent;
70 } 70 }
71 }, 71 },
72 mounted () { 72 mounted () {
test/unit/specs/select.spec.js
@@ -77,6 +77,27 @@ describe('Select.vue', () => { @@ -77,6 +77,27 @@ describe('Select.vue', () => {
77 }); 77 });
78 }); 78 });
79 79
  80 + it('should display normal characters in input when in filterable mode', done => {
  81 + vm = createVue({
  82 + template: `
  83 + <Select v-model="value" filterable>
  84 + <Option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</Option>
  85 + </Select>
  86 + `,
  87 + data() {
  88 + return {
  89 + value: 2,
  90 + options: [{value: 1, label: '> 100$'}, {value: 2, label: '< 100$'}]
  91 + };
  92 + }
  93 + });
  94 + vm.$nextTick(() => {
  95 + const input = vm.$el.querySelector('.ivu-select-input');
  96 + expect(input.value).to.equal('< 100$');
  97 + done();
  98 + });
  99 + });
  100 +
80 it('should use the value\'s label instead of placeholder when both are set', done => { 101 it('should use the value\'s label instead of placeholder when both are set', done => {
81 vm = createVue({ 102 vm = createVue({
82 template: ` 103 template: `