test: fix jest failure

This commit is contained in:
chenjiahan 2021-09-05 16:33:28 +08:00
parent 911d0669de
commit ee1ee0fe29
20 changed files with 55 additions and 14 deletions

View File

@ -1,12 +1 @@
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
// @ts-ignore
import vant from '../../dist/package-entry';
import 'jest-canvas-mock';
declare global {
interface Window {
vant: any;
}
}
window.vant = vant;

View File

@ -1,4 +1,5 @@
<script setup>
import VanCalendar from '..';
import { useTranslate } from '../../../docs/site/use-translate';
const minDate = new Date(2012, 0, 10);

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { useTranslate } from '../../../docs/site/use-translate';
const t = useTranslate({

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,7 @@
<script setup lang="ts">
import VanField from '..';
import VanButton from '../../button';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '..';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,8 @@
<script setup lang="ts">
import VanForm from '..';
import VanField from '../../field';
import VanButton from '../../button';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';
import { FieldValidateError } from '../../field/types';

View File

@ -1,6 +1,19 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';
import VanForm from '..';
import VanRate from '../../rate';
import VanRadio from '../../radio';
import VanField from '../../field';
import VanButton from '../../button';
import VanSlider from '../../slider';
import VanSwitch from '../../switch';
import VanStepper from '../../stepper';
import VanCheckbox from '../../checkbox';
import VanUploader from '../../uploader';
import VanCellGroup from '../../cell-group';
import VanRadioGroup from '../../radio-group';
import VanCheckboxGroup from '../../checkbox-group';
import FieldTypeArea from './FieldTypeArea.vue';
import FieldTypePicker from './FieldTypePicker.vue';
import FieldTypeCalendar from './FieldTypeCalendar.vue';

View File

@ -1,8 +1,10 @@
<script setup lang="ts">
import VanArea, { AreaColumnOption } from '../../area';
import VanField from '../../field';
import VanPopup from '../../popup';
import { ref } from 'vue';
import { areaList } from '@vant/area-data';
import { useTranslate } from '../../../docs/site/use-translate';
import { AreaColumnOption } from '../../area';
import { areaListEn } from '../../area/demo/area-en';
const t = useTranslate({

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import VanField from '../../field';
import VanCalendar from '../../calendar';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,7 @@
<script setup lang="ts">
import VanField from '../../field';
import VanPopup from '../../popup';
import VanDatetimePicker from '../../datetime-picker';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,7 @@
<script setup lang="ts">
import VanField from '../../field';
import VanPopup from '../../popup';
import VanPicker from '../../picker';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';

View File

@ -1,4 +1,8 @@
<script setup lang="ts">
import VanForm from '../../form';
import VanField from '../../field';
import VanButton from '../../button';
import VanCellGroup from '../../cell-group';
import { ref } from 'vue';
import { useTranslate } from '../../../docs/site/use-translate';
import { FieldValidateError } from '../../field/types';
@ -42,7 +46,7 @@ const validator = (val: string) => /1\d{10}/.test(val);
const validatorMessage = (val: string) => t('invalid', val);
const asyncValidator = (val: string) =>
new Promise((resolve) => {
new Promise<boolean>((resolve) => {
Toast.loading(t('validating'));
setTimeout(() => {

View File

@ -27,7 +27,6 @@ export function snapshotDemo(Demo: any, option: any = {}) {
components: {
'demo-block': EmptyComponent,
},
plugins: [(window as any).vant],
},
});