ant-design/components/drawer/__tests__/Drawer.test.js

58 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-06-19 16:47:52 +08:00
import React from 'react';
import { mount } from 'enzyme';
import Drawer from '..';
describe('Drawer', () => {
2018-06-25 20:25:15 +08:00
it('render correctly', () => {
2018-06-26 11:19:49 +08:00
const wrapper = mount(
<Drawer
visible
width={400}
getContainer={false}
>
Here is content of Drawer
</Drawer>
);
2018-06-21 12:32:13 +08:00
expect(wrapper.render()).toMatchSnapshot();
});
it('have a title', () => {
2018-06-26 11:19:49 +08:00
const wrapper = mount(
<Drawer
visible
title="Test Title"
getContainer={false}
>
Here is content of Drawer
</Drawer>
);
2018-06-25 23:25:38 +08:00
expect(wrapper.render()).toMatchSnapshot();
2018-06-21 12:32:13 +08:00
});
it('closable is false', () => {
2018-06-26 11:19:49 +08:00
const wrapper = mount(
<Drawer
visible
closable={false}
getContainer={false}
>
Here is content of Drawer
</Drawer>
);
2018-06-25 23:25:38 +08:00
expect(wrapper.render()).toMatchSnapshot();
2018-06-21 12:32:13 +08:00
});
it('destroyOnClose is true', () => {
2018-06-26 11:19:49 +08:00
const wrapper = mount(
<Drawer
destroyOnClose
visible={false}
getContainer={false}
>
Here is content of Drawer
</Drawer>
);
2018-06-25 23:25:38 +08:00
expect(wrapper.render()).toMatchSnapshot();
2018-06-19 16:47:52 +08:00
});
});