Select: Fix issue (#22303)

Test: Update select 'filterable' test case
pull/22315/head
chanstart 2022-12-15 10:23:10 +08:00 committed by chenyang
parent c83968258e
commit 7b8eb0fc80
2 changed files with 6 additions and 2 deletions

View File

@ -138,6 +138,8 @@
this.visible = new RegExp(escapeRegexpString(query), 'i').test(this.currentLabel) || this.created;
if (!this.visible) {
this.select.filteredOptionsCount--;
} else if (query === '') {
this.select.filteredOptionsCount = this.select.optionsCount;
}
}
},

View File

@ -450,9 +450,11 @@ describe('Select', () => {
vm = getSelectVm({ filterable: true });
const select = vm.$children[0];
setTimeout(() => {
select.visible = true;
select.$nextTick(() => {
select.selectedLabel = '面';
select.onInputChange();
select.visible = true;
});
setTimeout(() => {
expect(select.filteredOptionsCount).to.equal(1);
done();