mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-01 05:39:45 +08:00
types: add onClick event shim (#8665)
This commit is contained in:
parent
f823c8818f
commit
1c2d64be3e
@ -86,8 +86,8 @@ test('should start counting after calling the start method', async () => {
|
|||||||
wrapper.vm.start();
|
wrapper.vm.start();
|
||||||
await later(50);
|
await later(50);
|
||||||
|
|
||||||
const laterShapShot = wrapper.html();
|
const laterSnapShot = wrapper.html();
|
||||||
expect(prevSnapShot).not.toEqual(laterShapShot);
|
expect(prevSnapShot).not.toEqual(laterSnapShot);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pause counting after calling the pause method', async () => {
|
test('should pause counting after calling the pause method', async () => {
|
||||||
@ -102,9 +102,9 @@ test('should pause counting after calling the pause method', async () => {
|
|||||||
const prevSnapShot = wrapper.html();
|
const prevSnapShot = wrapper.html();
|
||||||
wrapper.vm.pause();
|
wrapper.vm.pause();
|
||||||
await later(50);
|
await later(50);
|
||||||
const laterShapShot = wrapper.html();
|
const laterSnapShot = wrapper.html();
|
||||||
|
|
||||||
expect(prevSnapShot).toEqual(laterShapShot);
|
expect(prevSnapShot).toEqual(laterSnapShot);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should reset time after calling the reset method', async () => {
|
test('should reset time after calling the reset method', async () => {
|
||||||
@ -123,9 +123,9 @@ test('should reset time after calling the reset method', async () => {
|
|||||||
await later(50);
|
await later(50);
|
||||||
wrapper.vm.reset();
|
wrapper.vm.reset();
|
||||||
await nextTick();
|
await nextTick();
|
||||||
const laterShapShot = wrapper.html();
|
const laterSnapShot = wrapper.html();
|
||||||
|
|
||||||
expect(prevSnapShot).toEqual(laterShapShot);
|
expect(prevSnapShot).toEqual(laterSnapShot);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should format complete time correctly', () => {
|
test('should format complete time correctly', () => {
|
||||||
@ -197,8 +197,8 @@ test('should pause counting when deactivated', async () => {
|
|||||||
await later(50);
|
await later(50);
|
||||||
|
|
||||||
await wrapper.setData({ render: true });
|
await wrapper.setData({ render: true });
|
||||||
const laterShapShot = wrapper.html();
|
const laterSnapShot = wrapper.html();
|
||||||
expect(prevSnapShot).toEqual(laterShapShot);
|
expect(prevSnapShot).toEqual(laterSnapShot);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should emit change event when counting', async () => {
|
test('should emit change event when counting', async () => {
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
import { App } from 'vue';
|
import { App } from 'vue';
|
||||||
import { camelize } from './format/string';
|
import { camelize } from './format/string';
|
||||||
|
|
||||||
|
// https://github.com/youzan/vant/issues/8302
|
||||||
|
type EventShim = {
|
||||||
|
new (...args: any[]): {
|
||||||
|
$props: {
|
||||||
|
onClick?: (...args: any[]) => void;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export type WithInstall<T> = T & {
|
export type WithInstall<T> = T & {
|
||||||
install(app: App): void;
|
install(app: App): void;
|
||||||
};
|
} & EventShim;
|
||||||
|
|
||||||
// using any here because tsc will generate some weird results when using generics
|
// using any here because tsc will generate some weird results when using generics
|
||||||
export function withInstall<T>(options: any): WithInstall<T> {
|
export function withInstall<T>(options: any): WithInstall<T> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user