mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
import Circle from '..';
|
|
import { mount, later } from '../../../test';
|
|
|
|
// TODO
|
|
// test('should update to final rate immediately if speed is 0', async () => {
|
|
// const wrapper = mount(Circle, {
|
|
// props: {
|
|
// rate: 50,
|
|
// currentRate: 0,
|
|
// },
|
|
// });
|
|
|
|
// await later();
|
|
// expect(wrapper.emitted('update:currentRate')).toBeTruthy();
|
|
// });
|
|
|
|
test('should emit "update:currentRate" event during animation', async () => {
|
|
const wrapper = mount(Circle, {
|
|
props: {
|
|
rate: 50,
|
|
speed: 100,
|
|
},
|
|
});
|
|
|
|
expect(wrapper.emitted('update:currentRate')).toBeFalsy();
|
|
await later(50);
|
|
expect(wrapper.emitted('update:currentRate')).toBeTruthy();
|
|
});
|
|
|
|
test('should change circle size when using size prop', () => {
|
|
const wrapper = mount(Circle, {
|
|
props: {
|
|
size: 100,
|
|
},
|
|
});
|
|
|
|
expect(wrapper.element.style.width).toEqual('100px');
|
|
expect(wrapper.element.style.height).toEqual('100px');
|
|
});
|
|
|
|
test('should change stroke linecap when using stroke-linecap prop', () => {
|
|
const wrapper = mount(Circle, {
|
|
props: {
|
|
strokeLinecap: 'square',
|
|
},
|
|
});
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
});
|