-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(boxai-sidebar): BoxAISidebar header added (#3698)
* feat(boxai-sidebar): BoxAISidebar header added * chore(boxai-sidebar): Minor PR fix * chore(boxai-sidebar): PR fixes * chore(boxai-sidebar): PR fixes * chore(i18n): translations * chore(boxai-sidebar): UT fix * chore(boxai-sidebar): PR fixes * chore(boxai-sidebar): PR fixes * chore(boxai-sidebar): Minor PR fixes * chore(boxai-sidebar): Minor PR fixes * chore(boxai-sidebar): Minor PR fixes --------- Co-authored-by: Greg Wong <[email protected]>
- Loading branch information
1 parent
f4a562d
commit 130b6b6
Showing
5 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 23 additions & 1 deletion
24
src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
import React from 'react'; | ||
import { userEvent } from '@testing-library/user-event'; | ||
import { screen, render } from '../../../test-utils/testing-library'; | ||
import BoxAISidebarComponent, { BoxAISidebarProps } from '../BoxAISidebar'; | ||
|
||
const mockOnExpandClick = jest.fn(); | ||
|
||
describe('elements/content-sidebar/BoxAISidebar', () => { | ||
const renderComponent = (props = {}) => { | ||
const defaultProps = { | ||
onExpandPressed: jest.fn(), | ||
onExpandClick: mockOnExpandClick, | ||
} satisfies BoxAISidebarProps; | ||
|
||
render(<BoxAISidebarComponent {...defaultProps} {...props} />); | ||
}; | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
test('should render title', () => { | ||
renderComponent(); | ||
|
||
expect(screen.getByRole('heading', { level: 3, name: 'Box AI' })).toBeInTheDocument(); | ||
}); | ||
|
||
test('should have accessible "Expand" button', () => { | ||
renderComponent(); | ||
|
||
expect(screen.getByRole('button', { name: 'Expand' })).toBeInTheDocument(); | ||
}); | ||
|
||
test('should call onExpandClick when click "Expand" button', async () => { | ||
renderComponent(); | ||
|
||
const expandButton = screen.getByRole('button', { name: 'Expand' }); | ||
await userEvent.click(expandButton); | ||
|
||
expect(mockOnExpandClick).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters