diff --git a/components/drawer/__tests__/Drawer.test.js b/components/drawer/__tests__/Drawer.test.js
index 94f06693a0..e833940922 100644
--- a/components/drawer/__tests__/Drawer.test.js
+++ b/components/drawer/__tests__/Drawer.test.js
@@ -7,9 +7,11 @@ class DrawerTester extends React.Component {
saveContainer = (container) => {
this.container = container;
}
+
getContainer = () => {
return this.container;
}
+
render() {
return (
diff --git a/components/drawer/__tests__/DrawerEvent.test.js b/components/drawer/__tests__/DrawerEvent.test.js
index 5a940189d7..26c1c15bae 100644
--- a/components/drawer/__tests__/DrawerEvent.test.js
+++ b/components/drawer/__tests__/DrawerEvent.test.js
@@ -8,32 +8,39 @@ class DrawerEventTester extends React.Component {
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;
};
+
onClose = () => {
this.setState({
visible: false,
});
};
+
open = () => {
this.setState({
visible: true,
});
}
+
render() {
+ const { visible } = this.state;
return (
{
if (this.props.visible !== undefined) {
if (this.props.onClose) {
@@ -65,12 +67,14 @@ export default class Drawer extends React.Component<
return;
}
}
+
onMaskClick = (e: EventType) => {
if (!this.props.maskClosable) {
return;
}
this.close(e);
}
+
renderBody = () => {
if (this.props.destroyOnClose && !this.props.visible) {
return null;
@@ -107,6 +111,7 @@ export default class Drawer extends React.Component<
);
}
+
render() {
let { width, zIndex, style, ...rest } = this.props;
if (typeof width === 'number') {