SwitchCell: add change event test case

This commit is contained in:
陈嘉涵 2017-08-28 17:52:17 +08:00
parent b1823dd36a
commit 09944101db

View File

@ -71,4 +71,25 @@ describe('SwitchCell', () => {
}
});
});
it('listen to change event', (done) => {
wrapper = mount(SwitchCell, {
attachToDocument: true,
propsData: {
value: false
}
});
wrapper.vm.$on('input', (value) => {
wrapper.vm.value = value;
});
wrapper.vm.$on('change', (value) => {
expect(value).to.be.true;
done();
});
const switchEl = wrapper.find('.van-switch')[0];
switchEl.trigger('click');
});
});