mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 15:59:38 +08:00
86 lines
1.7 KiB
JavaScript
86 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import { render } from 'enzyme';
|
|
import Drawer from '..';
|
|
|
|
describe('Drawer', () => {
|
|
it('render correctly', () => {
|
|
const wrapper = render(
|
|
<Drawer
|
|
visible
|
|
width={400}
|
|
getContainer={false}
|
|
>
|
|
Here is content of Drawer
|
|
</Drawer>
|
|
);
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('render top drawer', () => {
|
|
const wrapper = render(
|
|
<Drawer
|
|
visible
|
|
height={400}
|
|
placement="top"
|
|
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();
|
|
});
|
|
|
|
it('destroyOnClose is true', () => {
|
|
const wrapper = render(
|
|
<Drawer
|
|
destroyOnClose
|
|
visible={false}
|
|
getContainer={false}
|
|
>
|
|
Here is content of Drawer
|
|
</Drawer>
|
|
);
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('className is test_drawer', () => {
|
|
const wrapper = render(
|
|
<Drawer
|
|
destroyOnClose
|
|
visible={false}
|
|
className="test_drawer"
|
|
getContainer={false}
|
|
>
|
|
Here is content of Drawer
|
|
</Drawer>
|
|
);
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|