Skip to content

Commit

Permalink
hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Renatavl committed Nov 19, 2024
1 parent 38615f7 commit e7550c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/containers/about-chat-sidebar/AboutChatSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ const AboutChatSidebar: FC<AboutChatSidebarProps> = ({
{t(`chatPage.sidebar.${titleText}`)}
</Typography>
{onClose && (
<IconButton onClick={onClose} sx={styles.closeButton}>
<IconButton
data-testid='close-icon'
onClick={onClose}
sx={styles.closeButton}
>
<CloseIcon />
</IconButton>
)}
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/containers/about-chat-sidebar/AboutChatSidebar.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

0 comments on commit e7550c4

Please sign in to comment.