From 07fe94d0a47a2166a83d7581786be6562354ed02 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 14 Aug 2020 14:53:07 +0800 Subject: [PATCH] test: update drawer snap --- antdv-demo | 2 +- .../drawer/__tests__/DrawerEvent.test.js | 20 ++-- .../drawer/__tests__/MultiDrawer.test.js | 48 +++----- .../__snapshots__/Drawer.test.js.snap | 8 +- .../__snapshots__/DrawerEvent.test.js.snap | 9 +- .../__tests__/__snapshots__/demo.test.js.snap | 109 +++++++++--------- 6 files changed, 90 insertions(+), 106 deletions(-) diff --git a/antdv-demo b/antdv-demo index 77eb896f2..75cbe7966 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 77eb896f2c0cf51093ed3f000c29ed380c440706 +Subproject commit 75cbe79669f7ce5dfe6c1a02d9dd4e2443840c08 diff --git a/components/drawer/__tests__/DrawerEvent.test.js b/components/drawer/__tests__/DrawerEvent.test.js index 210277341..8470e3553 100644 --- a/components/drawer/__tests__/DrawerEvent.test.js +++ b/components/drawer/__tests__/DrawerEvent.test.js @@ -34,14 +34,10 @@ const DrawerEventTester = { }, render() { const drawerProps = { - props: { - visible: this.visible, - getContainer: false, - ...this.$props, - }, - on: { - close: this.onClose, - }, + visible: this.visible, + getContainer: false, + ...this.$props, + onClose: this.onClose, }; return (
@@ -60,8 +56,8 @@ describe('Drawer', () => { await asyncExpect(() => { const body = wrapper.find('.ant-drawer-body').exists(); expect(body).toBe(true); - wrapper.find('button.ant-btn').trigger('click'); - const content = wrapper.find('.ant-drawer-body').vnode.elm.innerHTML; + wrapper.find('.ant-btn').trigger('click'); + const content = wrapper.find('.ant-drawer-body').element.innerHTML; expect(content).toBe('Here is content of Drawer'); expect(wrapper.html()).toMatchSnapshot(); @@ -122,9 +118,7 @@ describe('Drawer', () => { wrapper.find('button.ant-btn').trigger('click'); expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true); - wrapper.setData({ - visible: false, - }); + wrapper.vm.visible = false; wrapper.find('.ant-drawer-wrapper-body').trigger('transitionend'); }); await asyncExpect(() => { diff --git a/components/drawer/__tests__/MultiDrawer.test.js b/components/drawer/__tests__/MultiDrawer.test.js index a026941eb..b434f8829 100644 --- a/components/drawer/__tests__/MultiDrawer.test.js +++ b/components/drawer/__tests__/MultiDrawer.test.js @@ -34,41 +34,27 @@ const MultiDrawer = { }, render() { const drawerProps = { - props: { - title: 'Multi-level drawer', - width: 520, - visible: this.visible, - getContainer: false, - wrapClassName: 'test_drawer', - placement: this.placement, - }, - on: { - close: this.onClose, - }, + title: 'Multi-level drawer', + width: 520, + visible: this.visible, + getContainer: false, + wrapClassName: 'test_drawer', + placement: this.placement, + onClose: this.onClose, }; const childrenDrawerProps = { - props: { - title: 'Two-level Drawer', - width: 320, - wrapClassName: 'Two-level', - visible: this.childrenDrawer, - getContainer: false, - placement: this.placement, - }, - on: { - close: this.onChildrenDrawerClose, - }, + title: 'Two-level Drawer', + width: 320, + wrapClassName: 'Two-level', + visible: this.childrenDrawer, + getContainer: false, + placement: this.placement, + onClose: this.onChildrenDrawerClose, }; const buttonProps = { - props: { - type: 'primary', - }, - attrs: { - id: 'open_drawer', - }, - on: { - click: this.showDrawer, - }, + type: 'primary', + id: 'open_drawer', + onClick: this.showDrawer, }; return (
diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index 73f276bb3..f95f6585b 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -8,7 +8,7 @@ exports[`Drawer class is test_drawer 1`] = `
-
+
Here is content of Drawer
@@ -60,7 +60,7 @@ exports[`Drawer have a title 1`] = `
-
Test Title
+
Test Title
Here is content of Drawer
@@ -79,7 +79,7 @@ exports[`Drawer render correctly 1`] = `
-
+
Here is content of Drawer
@@ -97,7 +97,7 @@ exports[`Drawer render top drawer 1`] = `
-
+
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 d85fb931c..98b9f7c03 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -1,17 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Drawer render correctly 1`] = ` -
+
-
+
-
+
+
Here is content of Drawer
+
diff --git a/components/drawer/__tests__/__snapshots__/demo.test.js.snap b/components/drawer/__tests__/__snapshots__/demo.test.js.snap index 43a65dcfa..3d2a80e10 100644 --- a/components/drawer/__tests__/__snapshots__/demo.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/demo.test.js.snap @@ -1,56 +1,48 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./antdv-demo/docs/drawer/demo/basic-right.md correctly 1`] = ` -
- -
+ + `; exports[`renders ./antdv-demo/docs/drawer/demo/form-in-drawer.md correctly 1`] = ` -
- -
+ + `; exports[`renders ./antdv-demo/docs/drawer/demo/multi-level-drawer.md correctly 1`] = ` -
- -
+ + `; exports[`renders ./antdv-demo/docs/drawer/demo/placement.md correctly 1`] = ` -
-
- -
+
+ `; exports[`renders ./antdv-demo/docs/drawer/demo/render-in-current.md correctly 1`] = ` -
- Render in this -
+
Render in this
-
+
Basic Drawer
+

Some contents...

+
@@ -58,39 +50,48 @@ exports[`renders ./antdv-demo/docs/drawer/demo/render-in-current.md correctly 1` `; exports[`renders ./antdv-demo/docs/drawer/demo/user-profile.md correctly 1`] = ` -
-
-
-
-
+
+ `;