From 505c0e7ef9ed62bdb9e94043db5e8bee412df1e2 Mon Sep 17 00:00:00 2001 From: Erwan Le Forestier Date: Fri, 13 Dec 2024 16:36:54 +0100 Subject: [PATCH] fix: missing last typed letter on filter tree event --- packages/primevue/src/tree/Tree.spec.js | 11 ++++++++--- packages/primevue/src/tree/Tree.vue | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/primevue/src/tree/Tree.spec.js b/packages/primevue/src/tree/Tree.spec.js index 3abc504cb..d2b0b507a 100644 --- a/packages/primevue/src/tree/Tree.spec.js +++ b/packages/primevue/src/tree/Tree.spec.js @@ -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 }) => { diff --git a/packages/primevue/src/tree/Tree.vue b/packages/primevue/src/tree/Tree.vue index db0474541..2c71a8371 100755 --- a/packages/primevue/src/tree/Tree.vue +++ b/packages/primevue/src/tree/Tree.vue @@ -9,7 +9,7 @@ - + @@ -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(); }