mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
import CellGroup from 'packages/cell-group';
|
|
import Cell from 'packages/cell';
|
|
import { mount } from 'avoriaz';
|
|
|
|
describe('CellGroup', () => {
|
|
let wrapper;
|
|
afterEach(() => {
|
|
wrapper && wrapper.destroy();
|
|
});
|
|
|
|
it('create a cell-group', () => {
|
|
wrapper = mount(CellGroup, {
|
|
propsData: {}
|
|
});
|
|
|
|
expect(wrapper.hasClass('zan-cell-group')).to.be.true;
|
|
});
|
|
});
|
|
|
|
describe('Cell', () => {
|
|
let wrapper;
|
|
afterEach(() => {
|
|
wrapper && wrapper.destroy();
|
|
});
|
|
|
|
it('create', () => {
|
|
wrapper = mount(Cell);
|
|
|
|
expect(wrapper.hasClass('zan-cell')).to.be.true;
|
|
});
|
|
|
|
it('create a required cell', () => {
|
|
wrapper = mount(Cell, {
|
|
propsData: {
|
|
required: true
|
|
}
|
|
});
|
|
|
|
expect(wrapper.hasClass('zan-cell')).to.be.true;
|
|
expect(wrapper.hasClass('zan-cell--required')).to.be.true;
|
|
});
|
|
|
|
it('emit a click event', () => {
|
|
wrapper = mount(Cell);
|
|
|
|
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
|
wrapper.simulate('click');
|
|
|
|
expect(eventStub.calledOnce).to.be.true;
|
|
expect(eventStub.calledWith('click')).to.be.true;
|
|
});
|
|
});
|