fix(Slider): should format initial value (#4337)

This commit is contained in:
neverland
2019-09-03 11:57:48 +08:00
committed by GitHub
parent 390e89fca2
commit 45d60aaf88
6 changed files with 29 additions and 5 deletions
+20 -1
View File
@@ -1,5 +1,10 @@
import Slider from '..';
import { mount, trigger, triggerDrag, mockGetBoundingClientRect } from '../../../test/utils';
import {
mount,
trigger,
triggerDrag,
mockGetBoundingClientRect
} from '../../../test/utils';
function mockRect(vertical) {
return mockGetBoundingClientRect({
@@ -134,3 +139,17 @@ it('should not emit change event when value not changed', () => {
expect(wrapper.emitted('change').length).toEqual(1);
});
it('should format initial value', done => {
mount(Slider, {
propsData: {
value: null
},
listeners: {
input(value) {
expect(value).toEqual(0);
done();
}
}
});
});