diff --git a/src/DrawerChild.tsx b/src/DrawerChild.tsx index 07d36c88..cec41de9 100644 --- a/src/DrawerChild.tsx +++ b/src/DrawerChild.tsx @@ -28,6 +28,10 @@ interface IState { } class DrawerChild extends React.Component { + static defaultProps = { + switchScrollingEffect: () => {}, + } + public static getDerivedStateFromProps(props: IDrawerChildProps, { prevProps, _self }: { prevProps: IDrawerChildProps, _self: DrawerChild }) { const nextState = { diff --git a/tests/__snapshots__/index.spec.tsx.snap b/tests/__snapshots__/index.spec.tsx.snap index 34c30a72..1d9499a9 100644 --- a/tests/__snapshots__/index.spec.tsx.snap +++ b/tests/__snapshots__/index.spec.tsx.snap @@ -1,5 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`rc-drawer-menu getContainer 1`] = ` +
+`; + exports[`rc-drawer-menu getContainer is null 1`] = `
- {props.show && } + {show && }
); } @@ -187,4 +188,12 @@ describe('rc-drawer-menu', () => { instance = mount(); expect(toJson(instance.render())).toMatchSnapshot(); }); + + it('getContainer', () => { + instance = mount(
); + instance.setProps({ + show: false, + }); + expect(toJson(instance.render())).toMatchSnapshot(); + }); });