1 | import * as React from 'react';
|
2 | import render from '../../_utils/tests/render';
|
3 | import { Box } from '../../primitives';
|
4 | import Sidebar from '../Sidebar';
|
5 |
|
6 | jest.mock('reakit/Portal', () => 'portal');
|
7 |
|
8 | it('renders correctly for a default Sidebar', () => {
|
9 | const { container } = render(
|
10 | <Sidebar.Container defaultVisible>
|
11 | {sidebar => <Sidebar {...sidebar}>This is the content</Sidebar>}
|
12 | </Sidebar.Container>,
|
13 | { theme: { Toast: { disabled: true } } }
|
14 | );
|
15 | expect(container.firstChild).toMatchSnapshot();
|
16 | });
|
17 |
|
18 | it('renders correctly for a Sidebar with align prop set', () => {
|
19 | const { container } = render(
|
20 | <Sidebar.Container defaultVisible>
|
21 | {sidebar => (
|
22 | <Sidebar align="right" {...sidebar}>
|
23 | This is the content
|
24 | </Sidebar>
|
25 | )}
|
26 | </Sidebar.Container>,
|
27 | { theme: { Toast: { disabled: true } } }
|
28 | );
|
29 | expect(container.firstChild).toMatchSnapshot();
|
30 | });
|
31 |
|
32 | it('renders correctly for a Sidebar with hideCloseButton prop set', () => {
|
33 | const { container } = render(
|
34 | <Sidebar.Container defaultVisible>
|
35 | {sidebar => (
|
36 | <Sidebar hideCloseButton {...sidebar}>
|
37 | This is the content
|
38 | </Sidebar>
|
39 | )}
|
40 | </Sidebar.Container>,
|
41 | { theme: { Toast: { disabled: true } } }
|
42 | );
|
43 | expect(container.firstChild).toMatchSnapshot();
|
44 | });
|