From 72cb97d4a7a76f5e9a1850cd70f4a7db369691b5 Mon Sep 17 00:00:00 2001 From: daniele-mng Date: Tue, 21 Jan 2025 08:46:15 +0100 Subject: [PATCH] fix: Select component empty value selection --- src/web/components/form/__tests__/select.jsx | 32 ++++++++++++++++++++ src/web/components/form/select.jsx | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/web/components/form/__tests__/select.jsx b/src/web/components/form/__tests__/select.jsx index 488a2d22c6..1a5745a6a5 100644 --- a/src/web/components/form/__tests__/select.jsx +++ b/src/web/components/form/__tests__/select.jsx @@ -210,6 +210,38 @@ describe('Select component tests', () => { expect(getSelectItemElements().length).toEqual(1); }); + + test('should not call onChange handler when newValue is null or undefined', async () => { + const items = [ + { + value: 'bar', + label: 'Bar', + }, + { + value: 'foo', + label: 'Foo', + }, + ]; + + const onChange = testing.fn(); + + render(