[improvement] test utils ts (#3024)

This commit is contained in:
neverland
2019-03-21 11:00:50 +08:00
committed by GitHub
parent f03b200b37
commit 5c0ae2dc06
4 changed files with 38 additions and 17 deletions
+22
View File
@@ -0,0 +1,22 @@
import Vue from 'vue';
import '../docs/src/demo-common';
import Locale from '../packages/locale';
import { renderToString } from '@vue/server-test-utils';
const empty = {
template: '<div><slot></slot></div>',
inheritAttrs: false
};
Vue.component('demo-block', empty);
Vue.component('demo-section', empty);
export default function (Demo: any) {
test('renders demo correctly', () => {
if (Demo.i18n) {
Locale.add(Demo.i18n);
}
expect(renderToString(Demo)).toMatchSnapshot();
});
}