diff --git a/components/drawer/__tests__/Drawer.test.js b/components/drawer/__tests__/Drawer.test.js index e833940922..fec1c7b734 100644 --- a/components/drawer/__tests__/Drawer.test.js +++ b/components/drawer/__tests__/Drawer.test.js @@ -2,50 +2,56 @@ import React from 'react'; import { mount } from 'enzyme'; import Drawer from '..'; - -class DrawerTester extends React.Component { - saveContainer = (container) => { - this.container = container; - } - - getContainer = () => { - return this.container; - } - - render() { - return ( -
-
- - Here is content of Drawer - -
- ); - } -} - describe('Drawer', () => { it('render correctly', () => { - const wrapper = mount(); + const wrapper = mount( + + Here is content of Drawer + + ); expect(wrapper.render()).toMatchSnapshot(); }); it('have a title', () => { - const wrapper = mount(); + const wrapper = mount( + + Here is content of Drawer + + ); expect(wrapper.render()).toMatchSnapshot(); }); it('closable is false', () => { - const wrapper = mount(); + const wrapper = mount( + + Here is content of Drawer + + ); expect(wrapper.render()).toMatchSnapshot(); }); it('destroyOnClose is true', () => { - const wrapper = mount(); + const wrapper = mount( + + Here is content of Drawer + + ); expect(wrapper.render()).toMatchSnapshot(); }); }); diff --git a/components/drawer/__tests__/DrawerEvent.test.js b/components/drawer/__tests__/DrawerEvent.test.js index 26c1c15bae..454281513c 100644 --- a/components/drawer/__tests__/DrawerEvent.test.js +++ b/components/drawer/__tests__/DrawerEvent.test.js @@ -13,14 +13,6 @@ class DrawerEventTester extends React.Component { 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, @@ -38,12 +30,11 @@ class DrawerEventTester extends React.Component { return (
-
Here is content of Drawer diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index daf7fffaec..5172c8d481 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -1,30 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Drawer closable is false 1`] = ` -
-
-
+
+
+
+
-
-
-
- Here is content of Drawer -
-
+ Here is content of Drawer
@@ -34,54 +32,67 @@ exports[`Drawer closable is false 1`] = ` `; exports[`Drawer destroyOnClose is true 1`] = ` -
-
+
+
+
+
+
+
+
`; exports[`Drawer have a title 1`] = ` -
-
-
+
+
+
+
-
-
-
- Test Title -
-
- -
- Here is content of Drawer -
+ Test Title
+ +
+ Here is content of Drawer +
@@ -90,38 +101,36 @@ exports[`Drawer have a title 1`] = ` `; exports[`Drawer render correctly 1`] = ` -
-
-
+
+
+
+
-
-
-
- -
- Here is content of Drawer -
-
+ + +
+ Here is content of Drawer
diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap index 2b5b4f4f8e..d33ae26243 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -10,36 +10,36 @@ exports[`Drawer render correctly 1`] = ` open -
-
+
+
+
-
-
- -
- Here is content of Drawer -
+ + +
+ Here is content of Drawer
diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index c080f38970..d7837dd954 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -37,7 +37,7 @@ export default class Drawer extends React.Component< static propTypes = { closable: PropTypes.bool, destroyOnClose: PropTypes.bool, - getContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]), + getContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func, PropTypes.bool]), maskClosable: PropTypes.bool, mask: PropTypes.bool, maskStyle: PropTypes.object, diff --git a/package.json b/package.json index fd957b1b63..5e9b5c7d53 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "rc-checkbox": "~2.1.5", "rc-collapse": "~1.9.0", "rc-dialog": "~7.1.0", - "rc-drawer": "~1.4.1", + "rc-drawer": "~1.4.2", "rc-dropdown": "~2.2.0", "rc-editor-mention": "^1.0.2", "rc-form": "^2.1.0",