You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
948 B

import React from 'react';
import { mount } from 'enzyme';
import Drawer from '..';
jest.mock('rc-util/lib/Portal');
class DrawerTester extends React.Component {
constructor(props) {
super(props);
this.state = { visible: false };
}
componentDidMount() {
this.setState({ visible: true }); // eslint-disable-line react/no-did-mount-set-state
}
saveContainer = (container) => {
this.container = container;
}
getContainer = () => {
return this.container;
}
render() {
return (
<div>
<div ref={this.saveContainer} />
<Drawer
{...this.props}
visible={this.state.visible}
getContainer={this.getContainer}
>
Here is content of Drawer
</Drawer>
</div>
);
}
}
describe('Drawer', () => {
it('render correctly', () => {
const wrapper = mount(<DrawerTester />);
expect(wrapper.render()).toMatchSnapshot();
});
});