mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
test: Back of test coverage (#24418)
* test: Back of test coverage * move rtl test out
This commit is contained in:
parent
03e6b33681
commit
faa75d592c
@ -0,0 +1,7 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Collapse rtl render component should be rendered correctly in RTL direction 1`] = `
|
||||||
|
<div
|
||||||
|
class="ant-collapse ant-collapse-icon-position-right ant-collapse-rtl"
|
||||||
|
/>
|
||||||
|
`;
|
@ -49,12 +49,6 @@ exports[`Collapse could override default openAnimation 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Collapse rtl render component should be rendered correctly in RTL direction 1`] = `
|
|
||||||
<div
|
|
||||||
class="ant-collapse ant-collapse-icon-position-right ant-collapse-rtl"
|
|
||||||
/>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Collapse should render extra node of panel 1`] = `
|
exports[`Collapse should render extra node of panel 1`] = `
|
||||||
<div
|
<div
|
||||||
class="ant-collapse ant-collapse-icon-position-left"
|
class="ant-collapse ant-collapse-icon-position-left"
|
||||||
|
8
components/collapse/__tests__/common.test.js
Normal file
8
components/collapse/__tests__/common.test.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
|
import Collapse from '..';
|
||||||
|
|
||||||
|
describe('Collapse', () => {
|
||||||
|
mountTest(Collapse);
|
||||||
|
rtlTest(Collapse);
|
||||||
|
});
|
@ -1,7 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
|
||||||
import { sleep } from '../../../tests/utils';
|
import { sleep } from '../../../tests/utils';
|
||||||
|
|
||||||
describe('Collapse', () => {
|
describe('Collapse', () => {
|
||||||
@ -18,8 +16,6 @@ describe('Collapse', () => {
|
|||||||
|
|
||||||
// eslint-disable-next-line global-require
|
// eslint-disable-next-line global-require
|
||||||
const Collapse = require('..').default;
|
const Collapse = require('..').default;
|
||||||
mountTest(Collapse);
|
|
||||||
rtlTest(Collapse);
|
|
||||||
|
|
||||||
it('should support remove expandIcon', () => {
|
it('should support remove expandIcon', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
@ -65,11 +61,10 @@ describe('Collapse', () => {
|
|||||||
</Collapse>,
|
</Collapse>,
|
||||||
);
|
);
|
||||||
expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(false);
|
expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(false);
|
||||||
wrapper
|
wrapper.find('.ant-collapse-header').at(0).simulate('click');
|
||||||
.find('.ant-collapse-header')
|
wrapper.update();
|
||||||
.at(0)
|
|
||||||
.simulate('click');
|
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
|
wrapper.update();
|
||||||
expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(true);
|
expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -81,10 +76,7 @@ describe('Collapse', () => {
|
|||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
</Collapse>,
|
</Collapse>,
|
||||||
);
|
);
|
||||||
wrapper
|
wrapper.find('.ant-collapse-header').at(0).simulate('click');
|
||||||
.find('.ant-collapse-header')
|
|
||||||
.at(0)
|
|
||||||
.simulate('click');
|
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(wrapper.render()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user