fix: missing last typed letter on filter tree event
parent
537772da64
commit
505c0e7ef9
|
@ -47,12 +47,17 @@ describe('Tree.vue', () => {
|
|||
filter: true
|
||||
}
|
||||
});
|
||||
|
||||
let searchField = wrapper.find('input.p-inputtext');
|
||||
const key = 't';
|
||||
searchField.element.value = key;
|
||||
|
||||
let searchField = wrapper.find('input.p-inputtext');
|
||||
|
||||
await searchField.trigger('keydown.space');
|
||||
await searchField.trigger('keyup', {
|
||||
key
|
||||
});
|
||||
|
||||
expect(wrapper.emitted('filter')).toBeTruthy();
|
||||
expect(wrapper.emitted('filter')[0][0].value).toEqual(key);
|
||||
});
|
||||
|
||||
it('should render icon', ({ expect }) => {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<IconField v-if="filter" :unstyled="unstyled" :pt="{ ...ptm('pcFilter'), ...ptm('pcFilterContainer') }" :class="cx('pcFilterContainer')">
|
||||
<InputText v-model="filterValue" autocomplete="off" :class="cx('pcFilterInput')" :placeholder="filterPlaceholder" :unstyled="unstyled" @keydown="onFilterKeydown" :pt="ptm('pcFilterInput')" />
|
||||
<InputText v-model="filterValue" autocomplete="off" :class="cx('pcFilterInput')" :placeholder="filterPlaceholder" :unstyled="unstyled" @keyup="onFilterKeyup" :pt="ptm('pcFilterInput')" />
|
||||
<InputIcon :unstyled="unstyled" :pt="ptm('pcFilterIconContainer')">
|
||||
<!--TODO: searchicon deprecated since v4.0-->
|
||||
<slot :name="$slots.filtericon ? 'filtericon' : 'searchicon'" :class="cx('filterIcon')">
|
||||
|
@ -172,7 +172,7 @@ export default {
|
|||
isNodeLeaf(node) {
|
||||
return node.leaf === false ? false : !(node.children && node.children.length);
|
||||
},
|
||||
onFilterKeydown(event) {
|
||||
onFilterKeyup(event) {
|
||||
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue