Skip to content

Commit

Permalink
Merge pull request iview#2193 from SergioCrisostomo/fix-2191
Browse files Browse the repository at this point in the history
correct input value in filterable mode
  • Loading branch information
icarusion committed Oct 26, 2017
2 parents 9147e63 + dfae43a commit 252717e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/select/option.vue
Expand Up @@ -66,7 +66,7 @@
},
// 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865
updateSearchLabel () {
this.searchLabel = this.$el.innerHTML;
this.searchLabel = this.$el.textContent;
}
},
mounted () {
Expand Down
21 changes: 21 additions & 0 deletions test/unit/specs/select.spec.js
Expand Up @@ -77,6 +77,27 @@ describe('Select.vue', () => {
});
});

it('should display normal characters in input when in filterable mode', done => {
vm = createVue({
template: `
<Select v-model="value" filterable>
<Option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
`,
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: `
Expand Down

0 comments on commit 252717e

Please sign in to comment.