From e05e7cbe3078e2c46c241fde83ad6fd30fb2cb07 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 3 Jul 2024 14:46:05 -0500 Subject: [PATCH] fix combobox test --- packages/react/src/components/Combobox/Combobox.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react/src/components/Combobox/Combobox.test.tsx b/packages/react/src/components/Combobox/Combobox.test.tsx index f98b9adbe..b0e13e06f 100644 --- a/packages/react/src/components/Combobox/Combobox.test.tsx +++ b/packages/react/src/components/Combobox/Combobox.test.tsx @@ -515,6 +515,9 @@ test('should prevent default with enter keypress and open listbox', () => { // rtl doesn't let us mock preventDefault // see: https://github.com/testing-library/react-testing-library/issues/572 event.preventDefault = preventDefault; + if (type === 'focus') { + fireEvent.focusIn(combobox); + } fireEvent(combobox, event); }; @@ -545,6 +548,9 @@ test('should not prevent default with enter keypress and closed listbox', () => // rtl doesn't let us mock preventDefault // see: https://github.com/testing-library/react-testing-library/issues/572 event.preventDefault = preventDefault; + if (type === 'focus') { + fireEvent.focusIn(combobox); + } fireEvent(combobox, event); };