-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathPanelList.test.js
58 lines (54 loc) · 1.35 KB
/
PanelList.test.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react';
import PanelList from '../src/PanelList';
import Panel, {PanelStyle} from '../src/Panel';
import {shallow, mount} from 'enzyme';
import toJson from 'enzyme-to-json';
import 'jest-styled-components';
describe('render', () => {
test('render one Panel', () => {
const component = mount(
<PanelList activeIndex={0}>
<Panel>
<span>panel content</span>
</Panel>
</PanelList>
);
expect(toJson(component)).toMatchSnapshot();
});
test('render multi Panel', () => {
const component = mount(
<PanelList activeIndex={1}>
<Panel>
<span>panel content</span>
</Panel>
<Panel>
<span>panel content</span>
</Panel>
<Panel>
<span>panel content</span>
</Panel>
</PanelList>
);
expect(toJson(component)).toMatchSnapshot();
});
test('return null if no child', () => {
const component = shallow(
<PanelList>
</PanelList>
);
expect(component.html()).toEqual(null);
})
})
test('custom style', () => {
const component = shallow(
<PanelList activeIndex={1}
customStyle={{
Panel: PanelStyle
}}>
<Panel>
<span>panel content</span>
</Panel>
</PanelList>
);
expect(toJson(component)).toMatchSnapshot();
})