[build] optimize demo test

This commit is contained in:
陈嘉涵
2019-05-08 15:52:32 +08:00
parent c92791e8da
commit 782215c94c
42 changed files with 1313 additions and 428 deletions
+10 -4
View File
@@ -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();
});
}