mirror of
https://github.com/youzan/vant.git
synced 2025-12-19 01:02:29 +08:00
SwitchCell: add change event test case
This commit is contained in:
@@ -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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user