fix(editor): Handle Leading Spaces in Workflow Search (#13889)

This commit is contained in:
Eti Ijeoma
2025-03-25 14:31:12 +01:00
committed by GitHub
parent 6eee081cf3
commit 8aad7dbaf6
2 changed files with 17 additions and 1 deletions

View File

@@ -247,5 +247,21 @@ describe('NodesListPanel', () => {
await nextTick(); await nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(9); expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(9);
}); });
it('should trim search input before emitting update', async () => {
renderComponent();
await nextTick();
expect(screen.queryByTestId('node-creator-search-bar')).toBeInTheDocument();
await fireEvent.input(screen.getByTestId('node-creator-search-bar'), {
target: { value: ' Node 1' },
});
await nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(1);
expect(screen.queryByText('Node 1')).toBeInTheDocument();
expect(screen.getByTestId('node-creator-search-bar')).toHaveValue('Node 1');
});
}); });
}); });

View File

@@ -28,7 +28,7 @@ function focus() {
function onInput(event: Event) { function onInput(event: Event) {
const input = event.target as HTMLInputElement; const input = event.target as HTMLInputElement;
emit('update:modelValue', input.value); emit('update:modelValue', input.value.trim());
} }
function clear() { function clear() {