From e7550c49bc0ba4e72cd8277bbe2a8e8c5fe65a23 Mon Sep 17 00:00:00 2001 From: renata_vl Date: Tue, 19 Nov 2024 23:29:12 +0200 Subject: [PATCH] hot fix --- .../about-chat-sidebar/AboutChatSidebar.tsx | 6 +++++- .../about-chat-sidebar/AboutChatSidebar.spec.jsx | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/containers/about-chat-sidebar/AboutChatSidebar.tsx b/src/containers/about-chat-sidebar/AboutChatSidebar.tsx index abf7c84d0..f3ae439ed 100644 --- a/src/containers/about-chat-sidebar/AboutChatSidebar.tsx +++ b/src/containers/about-chat-sidebar/AboutChatSidebar.tsx @@ -67,7 +67,11 @@ const AboutChatSidebar: FC = ({ {t(`chatPage.sidebar.${titleText}`)} {onClose && ( - + )} diff --git a/tests/unit/containers/about-chat-sidebar/AboutChatSidebar.spec.jsx b/tests/unit/containers/about-chat-sidebar/AboutChatSidebar.spec.jsx index 6b511ab87..21dba10b2 100644 --- a/tests/unit/containers/about-chat-sidebar/AboutChatSidebar.spec.jsx +++ b/tests/unit/containers/about-chat-sidebar/AboutChatSidebar.spec.jsx @@ -65,4 +65,20 @@ describe('AboutChatSidebar component test', () => { expect(screen.getByText('Space2Study WebApp')).toBeInTheDocument() }) + + it('should render close button and call onClose on click', () => { + const onCloseMock = vi.fn() + + setup({ + member: mockMember, + links: [], + onClose: onCloseMock + }) + + const closeButton = screen.getByTestId('close-icon') + expect(closeButton).toBeInTheDocument() + + closeButton.click() + expect(onCloseMock).toHaveBeenCalledTimes(1) + }) })