first commit

This commit is contained in:
编码猿
2024-09-27 00:57:27 +08:00
commit 18df0f5e4b
2548 changed files with 253280 additions and 0 deletions

36
vant/test/demo.ts Normal file
View File

@@ -0,0 +1,36 @@
import Vue, { CreateElement } from 'vue';
import '../docs/site/mobile';
import Locale from '../src/locale';
import { mount, later } from '.';
const Empty = {
render(h: CreateElement): ReturnType<CreateElement> {
return h('div', [(this as any).$slots.default]);
},
inheritAttrs: false,
};
Vue.component('demo-block', Empty);
Vue.component('demo-section', Empty);
export function snapshotDemo(Demo: any, option: any = {}) {
test('renders demo correctly', async () => {
if (option.beforeTest) {
option.beforeTest();
}
if (Demo.i18n) {
Locale.add(Demo.i18n);
}
const wrapper = mount(Demo);
await later();
expect(wrapper).toMatchSnapshot();
if (option.afterTest) {
option.afterTest();
}
});
}