From faa75d592c398acffe7a7b522679e686e9e09b7e 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: Sun, 24 May 2020 00:12:29 +0800 Subject: [PATCH] test: Back of test coverage (#24418) * test: Back of test coverage * move rtl test out --- .../__tests__/__snapshots__/common.test.js.snap | 7 +++++++ .../__tests__/__snapshots__/index.test.js.snap | 6 ------ components/collapse/__tests__/common.test.js | 8 ++++++++ components/collapse/__tests__/index.test.js | 16 ++++------------ 4 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 components/collapse/__tests__/__snapshots__/common.test.js.snap create mode 100644 components/collapse/__tests__/common.test.js diff --git a/components/collapse/__tests__/__snapshots__/common.test.js.snap b/components/collapse/__tests__/__snapshots__/common.test.js.snap new file mode 100644 index 0000000000..284736e4f4 --- /dev/null +++ b/components/collapse/__tests__/__snapshots__/common.test.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Collapse rtl render component should be rendered correctly in RTL direction 1`] = ` +
+`; diff --git a/components/collapse/__tests__/__snapshots__/index.test.js.snap b/components/collapse/__tests__/__snapshots__/index.test.js.snap index f530d2a4ef..afecca9804 100644 --- a/components/collapse/__tests__/__snapshots__/index.test.js.snap +++ b/components/collapse/__tests__/__snapshots__/index.test.js.snap @@ -49,12 +49,6 @@ exports[`Collapse could override default openAnimation 1`] = `
`; -exports[`Collapse rtl render component should be rendered correctly in RTL direction 1`] = ` -
-`; - exports[`Collapse should render extra node of panel 1`] = `
{ + mountTest(Collapse); + rtlTest(Collapse); +}); diff --git a/components/collapse/__tests__/index.test.js b/components/collapse/__tests__/index.test.js index 8b612ad8b1..4561c27cc3 100644 --- a/components/collapse/__tests__/index.test.js +++ b/components/collapse/__tests__/index.test.js @@ -1,7 +1,5 @@ import React from 'react'; import { mount } from 'enzyme'; -import mountTest from '../../../tests/shared/mountTest'; -import rtlTest from '../../../tests/shared/rtlTest'; import { sleep } from '../../../tests/utils'; describe('Collapse', () => { @@ -18,8 +16,6 @@ describe('Collapse', () => { // eslint-disable-next-line global-require const Collapse = require('..').default; - mountTest(Collapse); - rtlTest(Collapse); it('should support remove expandIcon', () => { const wrapper = mount( @@ -65,11 +61,10 @@ describe('Collapse', () => { , ); expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(false); - wrapper - .find('.ant-collapse-header') - .at(0) - .simulate('click'); + wrapper.find('.ant-collapse-header').at(0).simulate('click'); + wrapper.update(); await sleep(400); + wrapper.update(); expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(true); }); @@ -81,10 +76,7 @@ describe('Collapse', () => { , ); - wrapper - .find('.ant-collapse-header') - .at(0) - .simulate('click'); + wrapper.find('.ant-collapse-header').at(0).simulate('click'); expect(wrapper.render()).toMatchSnapshot(); }); });