[build] optimize demo test
This commit is contained in:
+10
-4
@@ -1,10 +1,12 @@
|
||||
import Vue from 'vue';
|
||||
import '../docs/src/demo-common';
|
||||
import Locale from '../packages/locale';
|
||||
import { renderToString } from '@vue/server-test-utils';
|
||||
import { mount, later } from './utils';
|
||||
|
||||
const empty = {
|
||||
template: '<div><slot></slot></div>',
|
||||
render(h) {
|
||||
return h('div', [this.$slots.default]);
|
||||
},
|
||||
inheritAttrs: false
|
||||
};
|
||||
|
||||
@@ -12,11 +14,15 @@ Vue.component('demo-block', empty);
|
||||
Vue.component('demo-section', empty);
|
||||
|
||||
export default function (Demo: any) {
|
||||
test('renders demo correctly', () => {
|
||||
test('renders demo correctly', async () => {
|
||||
if (Demo.i18n) {
|
||||
Locale.add(Demo.i18n);
|
||||
}
|
||||
|
||||
expect(renderToString(Demo)).toMatchSnapshot();
|
||||
const wrapper = mount(Demo);
|
||||
|
||||
await later();
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user