From 24be945ea8851ba3aab6f827472dcc4f4d488079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 27 Jul 2022 23:44:45 +0800 Subject: [PATCH] fix: Not work in old browser (#36748) * fix: Drawer contentWrapperStyle logic * fix: Update style * test: Update snapshot * test: More test case --- .../drawer/__tests__/DrawerEvent.test.js | 14 +- .../__snapshots__/Drawer.test.js.snap | 18 +- .../__snapshots__/DrawerEvent.test.js.snap | 4 +- .../__snapshots__/demo-extend.test.tsx.snap | 3784 +++++++++++++++-- .../__tests__/__snapshots__/demo.test.js.snap | 4 - .../drawer/__tests__/demo-extend.test.tsx | 1 + components/drawer/demo/no-mask.md | 7 + components/drawer/style/drawer.less | 312 +- components/drawer/style/motion.less | 4 + package.json | 2 +- 10 files changed, 3433 insertions(+), 717 deletions(-) diff --git a/components/drawer/__tests__/DrawerEvent.test.js b/components/drawer/__tests__/DrawerEvent.test.js index d5e9f18c5a..1d3219ac6b 100644 --- a/components/drawer/__tests__/DrawerEvent.test.js +++ b/components/drawer/__tests__/DrawerEvent.test.js @@ -88,21 +88,21 @@ describe('Drawer', () => { act(() => { jest.runAllTimers(); }); - fireEvent.animationEnd(container.querySelector('.ant-drawer-content')); - expect(container.querySelector('.ant-drawer-content-hidden')).toBeTruthy(); + fireEvent.animationEnd(container.querySelector('.ant-drawer-content-wrapper')); + expect(container.querySelector('.ant-drawer-content-wrapper-hidden')).toBeTruthy(); // Show rerender(getDrawer({ visible: true, getContainer: false })); - expect(container.querySelector('.ant-drawer-content')).toBeTruthy(); - expect(container.querySelector('.ant-drawer-content-hidden')).toBeFalsy(); + expect(container.querySelector('.ant-drawer-content-wrapper')).toBeTruthy(); + expect(container.querySelector('.ant-drawer-content-wrapper-hidden')).toBeFalsy(); // Hide rerender(getDrawer({ visible: false, getContainer: false })); act(() => { jest.runAllTimers(); }); - fireEvent.animationEnd(container.querySelector('.ant-drawer-content')); - expect(container.querySelector('.ant-drawer-content-hidden')).toBeTruthy(); + fireEvent.animationEnd(container.querySelector('.ant-drawer-content-wrapper')); + expect(container.querySelector('.ant-drawer-content-wrapper-hidden')).toBeTruthy(); }); it('test afterVisibleChange', async () => { @@ -113,7 +113,7 @@ describe('Drawer', () => { act(() => { jest.runAllTimers(); }); - fireEvent.animationEnd(container.querySelector('.ant-drawer-content')); + fireEvent.animationEnd(container.querySelector('.ant-drawer-content-wrapper')); expect(afterVisibleChange).toBeCalledTimes(1); }); diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index 8b734f11ad..a67cf551a7 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -15,7 +15,7 @@ exports[`Drawer className is test_drawer 1`] = ` tabindex="0" />