feat: migrate Circle component

This commit is contained in:
chenjiahan
2020-07-12 15:11:43 +08:00
parent 8c4c51fea1
commit 94ae79d953
12 changed files with 777 additions and 10 deletions

View File

@@ -0,0 +1,59 @@
import Vue from 'vue';
import Circle from '..';
import { mount, later } from '../../../test';
test('speed is 0', async () => {
const wrapper = mount(Circle, {
propsData: {
rate: 50,
value: 0,
},
listeners: {
input(value) {
Vue.nextTick(() => {
wrapper.setProps({ value });
});
},
},
});
await later();
expect(wrapper).toMatchSnapshot();
});
test('animate', async () => {
const onInput = jest.fn();
mount(Circle, {
propsData: {
rate: 50,
speed: 100,
},
listeners: {
input: onInput,
},
});
await later(50);
expect(onInput).toHaveBeenCalled();
expect(onInput.mock.calls[0][0]).not.toEqual(0);
});
test('size prop', () => {
const wrapper = mount(Circle, {
propsData: {
size: 100,
},
});
expect(wrapper).toMatchSnapshot();
});
test('stroke-linecap prop', () => {
const wrapper = mount(Circle, {
propsData: {
strokeLinecap: 'square',
},
});
expect(wrapper).toMatchSnapshot();
});