2018-06-19 16:47:52 +08:00
|
|
|
import React from 'react';
|
2018-07-20 14:40:03 +08:00
|
|
|
import { render } from 'enzyme';
|
2018-06-19 16:47:52 +08:00
|
|
|
import Drawer from '..';
|
|
|
|
|
|
|
|
describe('Drawer', () => {
|
2018-07-20 14:40:03 +08:00
|
|
|
it('render correctly', () => {
|
|
|
|
const wrapper = render(
|
|
|
|
<Drawer
|
|
|
|
visible
|
|
|
|
width={400}
|
|
|
|
getContainer={false}
|
|
|
|
>
|
|
|
|
Here is content of Drawer
|
|
|
|
</Drawer>
|
|
|
|
);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('have a title', () => {
|
|
|
|
const wrapper = render(
|
|
|
|
<Drawer
|
|
|
|
visible
|
|
|
|
title="Test Title"
|
|
|
|
getContainer={false}
|
|
|
|
>
|
|
|
|
Here is content of Drawer
|
|
|
|
</Drawer>
|
|
|
|
);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('closable is false', () => {
|
|
|
|
const wrapper = render(
|
|
|
|
<Drawer
|
|
|
|
visible
|
|
|
|
closable={false}
|
|
|
|
getContainer={false}
|
|
|
|
>
|
|
|
|
Here is content of Drawer
|
|
|
|
</Drawer>
|
|
|
|
);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
2018-06-21 12:32:13 +08:00
|
|
|
it('destroyOnClose is true', () => {
|
2018-07-20 14:40:03 +08:00
|
|
|
const wrapper = render(
|
2018-06-26 11:19:49 +08:00
|
|
|
<Drawer
|
|
|
|
destroyOnClose
|
|
|
|
visible={false}
|
|
|
|
getContainer={false}
|
|
|
|
>
|
|
|
|
Here is content of Drawer
|
|
|
|
</Drawer>
|
|
|
|
);
|
2018-07-20 14:40:03 +08:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2018-06-19 16:47:52 +08:00
|
|
|
});
|
2018-07-22 11:27:48 +08:00
|
|
|
|
2018-08-05 14:16:08 +08:00
|
|
|
it('className is test_drawer', () => {
|
2018-07-22 11:27:48 +08:00
|
|
|
const wrapper = render(
|
|
|
|
<Drawer
|
|
|
|
destroyOnClose
|
|
|
|
visible={false}
|
2018-08-05 14:16:08 +08:00
|
|
|
className="test_drawer"
|
2018-07-22 11:27:48 +08:00
|
|
|
getContainer={false}
|
|
|
|
>
|
|
|
|
Here is content of Drawer
|
|
|
|
</Drawer>
|
|
|
|
);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
2018-06-19 16:47:52 +08:00
|
|
|
});
|