-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathWindowSideBar.test.jsx
More file actions
43 lines (41 loc) · 1.5 KB
/
WindowSideBar.test.jsx
File metadata and controls
43 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { render, screen } from '@tests/utils/test-utils';
import { WindowSideBar } from '../../../src/components/WindowSideBar';
/** create wrapper */
function createWrapper({ ...props }) {
return render(
<WindowSideBar
windowId="xyz"
{...props}
/>,
{
preloadedState: {
windows: {
xyz: {
companionWindowIds: [],
suggestedSearches: null,
},
},
},
},
);
}
describe('WindowSideBar when closed', () => {
it('renders without an error', () => {
createWrapper({});
expect(screen.queryByRole('navigation', { accessibleName: 'sidebarPanelsNavigation' })).not.toBeInTheDocument();
});
});
describe('WindowSideBar when open', () => {
it('renders in an open state', () => {
createWrapper({ sideBarOpen: true });
expect(screen.getByRole('navigation', { accessibleName: 'sidebarPanelsNavigation' })).toBeInTheDocument();
});
it('Renders drawer ltr by default', () => {
createWrapper({ sideBarOpen: true });
expect(screen.queryByRole('navigation', { accessibleName: 'sidebarPanelsNavigation' })).toHaveClass('MuiDrawer-paperAnchorLeft'); // eslint-disable-line testing-library/no-node-access
});
it('Renders drawer rtl when specified', () => {
createWrapper({ direction: 'rtl', sideBarOpen: true });
expect(screen.queryByRole('navigation', { accessibleName: 'sidebarPanelsNavigation' })).toHaveClass('MuiDrawer-paperAnchorRight'); // eslint-disable-line testing-library/no-node-access
});
});