Skip to content

Commit

Permalink
[MOD] 单元测试覆盖率达到95%
Browse files Browse the repository at this point in the history
  • Loading branch information
qianxu.ljj committed Jan 4, 2018
1 parent bc64e4c commit bf29906
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Collapse.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import Enzyme, { mount, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Collapse, {Panel} from '../src';
import { setTimeout } from 'timers';

Enzyme.configure({ adapter: new Adapter() });

Expand Down Expand Up @@ -60,8 +59,12 @@ describe('Collapse', () => {
expect(wrapper.prop('accordion')).to.be(true)
})

it('has correct click', () => {
it('has correct click', (done) => {
wrapper.find('.kuma-collapse-header').at(2).simulate('click')
expect(wrapper.state('activeKey')).to.be('3')
// 因为click后,需要等动画延迟后才会执行util.js中active和end
setTimeout(() => {
done()
}, 1000)
})
});

0 comments on commit bf29906

Please sign in to comment.