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