From 1425de31b7437356c5051344261f30f6f57c5bbe Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 14 Aug 2020 11:15:10 +0800 Subject: [PATCH] test: update modal snap --- components/modal/__tests__/Modal.test.js | 6 +-- .../__snapshots__/Modal.test.js.snap | 54 ++++++++++++------- .../__tests__/__snapshots__/demo.test.js.snap | 54 ++++++++++++++----- components/modal/__tests__/confirm.test.js | 8 +-- 4 files changed, 81 insertions(+), 41 deletions(-) diff --git a/components/modal/__tests__/Modal.test.js b/components/modal/__tests__/Modal.test.js index 8930001d7..fb8a6bc7e 100644 --- a/components/modal/__tests__/Modal.test.js +++ b/components/modal/__tests__/Modal.test.js @@ -12,10 +12,8 @@ const ModalTester = { }, render() { const modalProps = { - props: { - ...this.$props, - getContainer: this.getContainer, - }, + ...this.$props, + getContainer: this.getContainer, }; return (
diff --git a/components/modal/__tests__/__snapshots__/Modal.test.js.snap b/components/modal/__tests__/__snapshots__/Modal.test.js.snap index 1e6de6ab0..4fdcc4cd1 100644 --- a/components/modal/__tests__/__snapshots__/Modal.test.js.snap +++ b/components/modal/__tests__/__snapshots__/Modal.test.js.snap @@ -5,22 +5,27 @@ exports[`Modal render correctly 1`] = `
-
- + +
`; @@ -29,22 +34,27 @@ exports[`Modal render correctly 2`] = `
-
- + +
`; @@ -53,18 +63,22 @@ exports[`Modal render without footer 1`] = `
-
- + +
`; diff --git a/components/modal/__tests__/__snapshots__/demo.test.js.snap b/components/modal/__tests__/__snapshots__/demo.test.js.snap index b8c88424d..f24488017 100644 --- a/components/modal/__tests__/__snapshots__/demo.test.js.snap +++ b/components/modal/__tests__/__snapshots__/demo.test.js.snap @@ -1,47 +1,75 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./antdv-demo/docs/modal/demo/async.md correctly 1`] = ` -
+
`; exports[`renders ./antdv-demo/docs/modal/demo/basic.md correctly 1`] = ` -
+
`; exports[`renders ./antdv-demo/docs/modal/demo/button-props.md correctly 1`] = ` -
+
`; -exports[`renders ./antdv-demo/docs/modal/demo/confirm.md correctly 1`] = `
`; +exports[`renders ./antdv-demo/docs/modal/demo/confirm.md correctly 1`] = ` +
+`; -exports[`renders ./antdv-demo/docs/modal/demo/confirm-promise.md correctly 1`] = ``; +exports[`renders ./antdv-demo/docs/modal/demo/confirm-promise.md correctly 1`] = ` + +`; -exports[`renders ./antdv-demo/docs/modal/demo/confirm-router.md correctly 1`] = ``; +exports[`renders ./antdv-demo/docs/modal/demo/confirm-router.md correctly 1`] = ` + +`; exports[`renders ./antdv-demo/docs/modal/demo/footer.md correctly 1`] = ` -
+
`; -exports[`renders ./antdv-demo/docs/modal/demo/info.md correctly 1`] = `
`; +exports[`renders ./antdv-demo/docs/modal/demo/info.md correctly 1`] = ` +
+`; exports[`renders ./antdv-demo/docs/modal/demo/locale.md correctly 1`] = ` -
-

+
+

`; -exports[`renders ./antdv-demo/docs/modal/demo/manual.md correctly 1`] = ``; +exports[`renders ./antdv-demo/docs/modal/demo/manual.md correctly 1`] = ` + +`; exports[`renders ./antdv-demo/docs/modal/demo/position.md correctly 1`] = ` -
-

+
+

`; diff --git a/components/modal/__tests__/confirm.test.js b/components/modal/__tests__/confirm.test.js index b66e1c87a..224fe5f1e 100644 --- a/components/modal/__tests__/confirm.test.js +++ b/components/modal/__tests__/confirm.test.js @@ -79,8 +79,8 @@ describe('Modal.confirm triggers callbacks correctly', () => { it('allows extra props on buttons', async () => { open({ - okButtonProps: { props: { disabled: true } }, - cancelButtonProps: { attrs: { 'data-test': 'baz' } }, + okButtonProps: { disabled: true }, + cancelButtonProps: { 'data-test': 'baz' }, }); await sleep(); expect($$('.ant-btn')).toHaveLength(2); @@ -88,7 +88,7 @@ describe('Modal.confirm triggers callbacks correctly', () => { expect($$('.ant-btn')[1].disabled).toBe(true); }); - fit('trigger onCancel once when click on cancel button', async () => { + it('trigger onCancel once when click on cancel button', async () => { const arr = ['info', 'success', 'warning', 'error']; for (let type of arr) { Modal[type]({ @@ -98,7 +98,7 @@ describe('Modal.confirm triggers callbacks correctly', () => { await sleep(); expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(1); $$('.ant-btn')[0].click(); - await sleep(); + await sleep(500); expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(0); } });