mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
30 lines
756 B
JavaScript
30 lines
756 B
JavaScript
import { mount } from 'avoriaz';
|
|
import BadgeTestComponent from '../components/badge';
|
|
|
|
describe('BadgeGroup', () => {
|
|
let wrapper;
|
|
afterEach(() => {
|
|
wrapper && wrapper.destroy();
|
|
});
|
|
|
|
it('create a badge-group', () => {
|
|
wrapper = mount(BadgeTestComponent);
|
|
|
|
expect(wrapper.hasClass('zan-badge-group')).to.be.true;
|
|
|
|
expect(wrapper.vNode.child.activeKey).to.equal(0);
|
|
expect(wrapper.vNode.child.badges.length).to.equal(2);
|
|
});
|
|
|
|
it('emit a click event when click badge', () => {
|
|
wrapper = mount(BadgeTestComponent);
|
|
|
|
const badge = wrapper.find('.zan-badge')[0];
|
|
const eventStub = sinon.stub(badge.vNode.child, '$emit');
|
|
badge.simulate('click');
|
|
|
|
expect(eventStub.calledWith('click')).to.be.true;
|
|
});
|
|
});
|
|
|