[bugfix] Slider: should not emit change event when value not changed (#4087)

This commit is contained in:
neverland
2019-08-10 22:12:10 +08:00
committed by GitHub
parent 7e4795fa24
commit 135531cd03
4 changed files with 28 additions and 4 deletions
+18
View File
@@ -116,3 +116,21 @@ it('bar height', () => {
expect(wrapper).toMatchSnapshot();
});
it('should not emit change event when value not changed', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50
},
listeners: {
input(value) {
wrapper.setProps({ value });
}
}
});
trigger(wrapper, 'click', 100, 0);
trigger(wrapper, 'click', 100, 0);
expect(wrapper.emitted('change').length).toEqual(1);
});