From 85095afd82c12422184d008de668c5431ed048af Mon Sep 17 00:00:00 2001 From: Rik Claessens Date: Sat, 13 Jul 2024 11:40:40 +0200 Subject: [PATCH] Add test for checking if the SearchBar renders the provided custom search icon Signed-off-by: Rik Claessens --- .../components/SearchBar/SearchBar.test.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx b/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx index bdff7ba57c..3f667a4ad6 100644 --- a/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx +++ b/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx @@ -298,4 +298,37 @@ describe('SearchBar', () => { expect(analyticsApiMock.getEvents()).toHaveLength(0); }); + + it('Renders custom search icon', async () => { + const CustomSearchIcon = () => ( + + + + ); + + await renderInTestApp( + + + + + , + { + icons: { + search: CustomSearchIcon, + }, + }, + ); + + const queryButton = screen.getByLabelText('Query'); + + expect(queryButton).toBeInTheDocument(); + expect(queryButton.innerHTML).toContain( + '', + ); + }); });