mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Rate: add test cases (#1103)
This commit is contained in:
parent
86a2569614
commit
bb74fd0bd5
19
packages/rate/test/index.spec.js
Normal file
19
packages/rate/test/index.spec.js
Normal file
@ -0,0 +1,19 @@
|
||||
import Rate from '../';
|
||||
import { mount } from '@vue/test-utils';
|
||||
|
||||
test('change event', () => {
|
||||
const wrapper = mount(Rate, {
|
||||
propsData: {
|
||||
disabled: true
|
||||
}
|
||||
});
|
||||
const item4 = wrapper.findAll('.van-rate__item').at(3);
|
||||
|
||||
item4.trigger('click');
|
||||
expect(wrapper.emitted('change')).toBeFalsy();
|
||||
|
||||
wrapper.vm.disabled = false;
|
||||
item4.trigger('click');
|
||||
expect(wrapper.emitted('input')[0][0]).toEqual(4);
|
||||
expect(wrapper.emitted('change')[0][0]).toEqual(4);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user