correct input value in filterable mode

This commit is contained in:
Sergio Crisostomo 2017-10-25 20:49:38 +02:00
parent af7d72b4cc
commit dfae43a75c
2 changed files with 22 additions and 1 deletions

View file

@ -66,7 +66,7 @@
}, },
// 使 key SearchLabel #1865 // 使 key SearchLabel #1865
updateSearchLabel () { updateSearchLabel () {
this.searchLabel = this.$el.innerHTML; this.searchLabel = this.$el.textContent;
} }
}, },
mounted () { mounted () {

View file

@ -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 => { it('should use the value\'s label instead of placeholder when both are set', done => {
vm = createVue({ vm = createVue({
template: ` template: `