From 901811bc43f0af057f527e600ba9c8eaa32a902a Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 6 Jul 2022 17:40:21 +0800 Subject: [PATCH] chore: update jest to 28 --- .jest.js | 15 +- components/anchor/__tests__/Anchor.test.js | 27 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 63 +- .../__tests__/__snapshots__/demo.test.js.snap | 30 +- .../__tests__/__snapshots__/demo.test.js.snap | 38 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 3 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 - .../__tests__/__snapshots__/demo.test.js.snap | 189 +++-- .../__tests__/__snapshots__/demo.test.js.snap | 9 +- .../__tests__/__snapshots__/demo.test.js.snap | 276 +++---- .../__tests__/__snapshots__/demo.test.js.snap | 12 +- .../__tests__/__snapshots__/demo.test.js.snap | 59 +- .../__tests__/__snapshots__/demo.test.js.snap | 39 +- .../__tests__/__snapshots__/demo.test.js.snap | 3 - .../__tests__/__snapshots__/demo.test.js.snap | 711 +++++++++++------- .../__tests__/__snapshots__/demo.test.js.snap | 30 +- components/radio/__tests__/group.test.js | 66 +- .../__tests__/__snapshots__/demo.test.js.snap | 51 +- .../__tests__/__snapshots__/demo.test.js.snap | 11 +- .../__tests__/__snapshots__/demo.test.js.snap | 14 +- .../__tests__/__snapshots__/demo.test.js.snap | 37 +- .../__tests__/__snapshots__/demo.test.js.snap | 44 ++ .../__tests__/__snapshots__/demo.test.js.snap | 68 +- .../__tests__/__snapshots__/demo.test.js.snap | 12 +- .../__tests__/__snapshots__/demo.test.js.snap | 21 +- package.json | 15 +- tests/__snapshots__/index.test.js.snap | 70 +- tests/setup.js | 12 + 30 files changed, 1154 insertions(+), 779 deletions(-) diff --git a/.jest.js b/.jest.js index eee898ecc..225e60400 100644 --- a/.jest.js +++ b/.jest.js @@ -10,22 +10,21 @@ const transformIgnorePatterns = [ const testPathIgnorePatterns = ['/node_modules/', 'node']; module.exports = { - testURL: 'http://localhost/', setupFiles: ['./tests/setup.js'], moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue', 'md', 'jpg'], modulePathIgnorePatterns: ['/_site/'], testPathIgnorePatterns: testPathIgnorePatterns, transform: { - '^.+\\.(vue|md)$': '/node_modules/vue-jest', + '^.+\\.(vue|md)$': '/node_modules/@vue/vue3-jest', '^.+\\.(js|jsx)$': '/node_modules/babel-jest', '^.+\\.(ts|tsx)$': '/node_modules/ts-jest', '^.+\\.svg$': '/node_modules/jest-transform-stub', }, testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$', moduleNameMapper: { - '^@/(.*)$': '/$1', - 'ant-design-vue$': '/components/index.ts', - 'ant-design-vue/es': '/components', + '/^@/(.*)$/': '/$1', + '/ant-design-vue$/': '/components/index.ts', + '/ant-design-vue/es/': '/components', }, snapshotSerializers: ['/node_modules/jest-serializer-vue'], collectCoverage: process.env.COVERAGE === 'true', @@ -43,7 +42,11 @@ module.exports = { '!components/style.js', '!**/node_modules/**', ], - testEnvironment: 'jest-environment-jsdom-fifteen', + testEnvironment: 'jsdom', + testEnvironmentOptions: { + url: 'http://localhost', + customExportConditions: ['node', 'node-addons'], + }, transformIgnorePatterns, globals: { 'ts-jest': { diff --git a/components/anchor/__tests__/Anchor.test.js b/components/anchor/__tests__/Anchor.test.js index 6cbb10711..797fe44fe 100644 --- a/components/anchor/__tests__/Anchor.test.js +++ b/components/anchor/__tests__/Anchor.test.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils'; import { ref } from 'vue'; +import { sleep } from '../../../tests/utils'; import Anchor from '..'; const { Link } = Anchor; @@ -8,7 +9,7 @@ let idCounter = 0; const getHashUrl = () => `Anchor-API-${idCounter++}`; describe('Anchor Render', () => { - it('Anchor render perfectly', async done => { + it('Anchor render perfectly', async () => { const hash = getHashUrl(); const anchor = ref(null); const activeLink = ref(null); @@ -29,17 +30,13 @@ describe('Anchor Render', () => { }, { sync: false }, ); + await sleep(); + wrapper.find(`a[href="#${hash}`).trigger('click'); - wrapper.vm.$nextTick(() => { - wrapper.find(`a[href="#${hash}`).trigger('click'); - - setTimeout(() => { - expect(activeLink.value).not.toBe(hash); - done(); - }, 1000); - }); + await sleep(); + expect(activeLink.value).not.toBe(hash); }); - it('Anchor render perfectly for complete href - click', async done => { + it('Anchor render perfectly for complete href - click', async () => { const currentActiveLink = ref(null); const wrapper = mount( { @@ -58,13 +55,9 @@ describe('Anchor Render', () => { }, { sync: false }, ); - - wrapper.vm.$nextTick(() => { - wrapper.find('a[href="http://www.example.com/#API"]').trigger('click'); - - expect(currentActiveLink.value).toBe('http://www.example.com/#API'); - done(); - }); + await sleep(); + wrapper.find('a[href="http://www.example.com/#API"]').trigger('click'); + expect(currentActiveLink.value).toBe('http://www.example.com/#API'); }); /* it('Anchor render perfectly for complete href - scroll', done => { diff --git a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap index 552d8ff58..79fea6602 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap @@ -17,7 +17,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.vue correctly
@@ -412,7 +415,8 @@ exports[`renders ./components/calendar/demo/card.vue correctly 1`] = `
Nov -
+
@@ -807,7 +811,8 @@ exports[`renders ./components/calendar/demo/customize-header.vue correctly 1`] =
2016 -
+ @@ -817,7 +822,8 @@ exports[`renders ./components/calendar/demo/customize-header.vue correctly 1`] =
Nov -
+ @@ -1206,7 +1212,8 @@ exports[`renders ./components/calendar/demo/notice-calendar.vue correctly 1`] =
2016 -
+
@@ -1214,7 +1221,8 @@ exports[`renders ./components/calendar/demo/notice-calendar.vue correctly 1`] =
Nov -
+
@@ -1630,7 +1638,8 @@ exports[`renders ./components/calendar/demo/select.vue correctly 1`] = `
2017 -
+
@@ -1638,7 +1647,8 @@ exports[`renders ./components/calendar/demo/select.vue correctly 1`] = `
Jan -
+
diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index 67102bc6b..7d5cd95a2 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -6,7 +6,8 @@ exports[`renders ./components/cascader/demo/basic.vue correctly 1`] = `
Please select -
+ `; @@ -17,7 +18,8 @@ exports[`renders ./components/cascader/demo/change-on-select.vue correctly 1`] =
Please select -
+ `; @@ -28,7 +30,8 @@ exports[`renders ./components/cascader/demo/custom-render.vue correctly 1`] = `
Zhejiang /Hangzhou /West Lake ( 752100 ) -
+ `; @@ -40,7 +43,8 @@ exports[`renders ./components/cascader/demo/disabled-option.vue correctly 1`] =
Please select -
+ `; @@ -51,7 +55,8 @@ exports[`renders ./components/cascader/demo/fields-name.vue correctly 1`] = `
Please select -
+ `; @@ -62,7 +67,8 @@ exports[`renders ./components/cascader/demo/hover.vue correctly 1`] = `
Please select -
+ `; @@ -73,7 +79,8 @@ exports[`renders ./components/cascader/demo/lazy.vue correctly 1`] = `
Please select -
+ `; @@ -102,7 +109,8 @@ exports[`renders ./components/cascader/demo/search.vue correctly 1`] = `
Please select -
+ `; @@ -113,7 +121,8 @@ exports[`renders ./components/cascader/demo/size.vue correctly 1`] = `
Please select -
+
@@ -123,7 +132,8 @@ exports[`renders ./components/cascader/demo/size.vue correctly 1`] = `
Please select -
+
@@ -133,7 +143,8 @@ exports[`renders ./components/cascader/demo/size.vue correctly 1`] = `
Please select -
+
@@ -148,7 +159,8 @@ exports[`renders ./components/cascader/demo/suffix.vue correctly 1`] = `
Please select -
+ @@ -159,7 +171,7 @@ exports[`renders ./components/cascader/demo/suffix.vue correctly 1`] = `
Please select -
+ diff --git a/components/checkbox/__tests__/__snapshots__/demo.test.js.snap b/components/checkbox/__tests__/__snapshots__/demo.test.js.snap index 01ce052f8..d15d53e3a 100644 --- a/components/checkbox/__tests__/__snapshots__/demo.test.js.snap +++ b/components/checkbox/__tests__/__snapshots__/demo.test.js.snap @@ -3,7 +3,7 @@ exports[`renders ./components/checkbox/demo/basic.vue correctly 1`] = ``; exports[`renders ./components/checkbox/demo/check-all.vue correctly 1`] = ` -
+
diff --git a/components/collapse/__tests__/__snapshots__/demo.test.js.snap b/components/collapse/__tests__/__snapshots__/demo.test.js.snap index b07633ada..580c109f3 100644 --- a/components/collapse/__tests__/__snapshots__/demo.test.js.snap +++ b/components/collapse/__tests__/__snapshots__/demo.test.js.snap @@ -148,7 +148,8 @@ exports[`renders ./components/collapse/demo/extra.vue correctly 1`] = `
left -
+ `; diff --git a/components/comment/__tests__/__snapshots__/demo.test.js.snap b/components/comment/__tests__/__snapshots__/demo.test.js.snap index 002c75586..cd8860a66 100644 --- a/components/comment/__tests__/__snapshots__/demo.test.js.snap +++ b/components/comment/__tests__/__snapshots__/demo.test.js.snap @@ -36,7 +36,6 @@ exports[`renders ./components/comment/demo/editor.vue correctly 1`] = `
-
@@ -49,7 +48,6 @@ exports[`renders ./components/comment/demo/editor.vue correctly 1`] = `
-
diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index bccf1abcf..e73a9e1c3 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -4,7 +4,8 @@ exports[`renders ./components/date-picker/demo/basic.vue correctly 1`] = `
-
+
+
@@ -13,7 +14,8 @@ exports[`renders ./components/date-picker/demo/basic.vue correctly 1`] = `
-
+
+
@@ -22,7 +24,8 @@ exports[`renders ./components/date-picker/demo/basic.vue correctly 1`] = `
-
+
+
@@ -31,7 +34,8 @@ exports[`renders ./components/date-picker/demo/basic.vue correctly 1`] = `
-
+
+
@@ -40,7 +44,8 @@ exports[`renders ./components/date-picker/demo/basic.vue correctly 1`] = `
-
+
+
@@ -54,7 +59,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -63,7 +69,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -72,7 +79,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -81,7 +89,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -90,7 +99,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -102,7 +112,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -113,7 +124,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -124,7 +136,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -135,7 +148,8 @@ exports[`renders ./components/date-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -148,7 +162,8 @@ exports[`renders ./components/date-picker/demo/date-render.vue correctly 1`] = `
-
+
+
@@ -160,7 +175,8 @@ exports[`renders ./components/date-picker/demo/date-render.vue correctly 1`] = `
-
+
+
@@ -173,14 +189,17 @@ exports[`renders ./components/date-picker/demo/disabled.vue correctly 1`] = `
-
+
+ +
-
+
+
@@ -192,7 +211,8 @@ exports[`renders ./components/date-picker/demo/disabled.vue correctly 1`] = `
-
+
+
@@ -203,7 +223,8 @@ exports[`renders ./components/date-picker/demo/disabled.vue correctly 1`] = `
-
+
+
@@ -215,7 +236,8 @@ exports[`renders ./components/date-picker/demo/disabled-date.vue correctly 1`] =
-
+
+
@@ -224,7 +246,8 @@ exports[`renders ./components/date-picker/demo/disabled-date.vue correctly 1`] =
-
+
+
@@ -236,7 +259,8 @@ exports[`renders ./components/date-picker/demo/disabled-date.vue correctly 1`] =
-
+
+
@@ -247,7 +271,8 @@ exports[`renders ./components/date-picker/demo/disabled-date.vue correctly 1`] =
-
+
+
@@ -260,7 +285,8 @@ exports[`renders ./components/date-picker/demo/extra-footer.vue correctly 1`] =
-
+
+
@@ -269,7 +295,8 @@ exports[`renders ./components/date-picker/demo/extra-footer.vue correctly 1`] =
-
+
+
@@ -281,7 +308,8 @@ exports[`renders ./components/date-picker/demo/extra-footer.vue correctly 1`] =
-
+
+
@@ -292,7 +320,8 @@ exports[`renders ./components/date-picker/demo/extra-footer.vue correctly 1`] =
-
+
+
@@ -300,7 +329,8 @@ exports[`renders ./components/date-picker/demo/extra-footer.vue correctly 1`] =
-
+
+
@@ -314,21 +344,27 @@ exports[`renders ./components/date-picker/demo/format.vue correctly 1`] = `
-
+
+ +
-
+
+ +
-
+
+ +
@@ -338,21 +374,26 @@ exports[`renders ./components/date-picker/demo/format.vue correctly 1`] = `
-
+
+
-
+
+ +
-
+
+ +
@@ -364,7 +405,8 @@ exports[`renders ./components/date-picker/demo/mode.vue correctly 1`] = `
-
+
+
@@ -376,7 +418,8 @@ exports[`renders ./components/date-picker/demo/mode.vue correctly 1`] = `
-
+
+
@@ -392,7 +435,8 @@ exports[`renders ./components/date-picker/demo/presetted-ranges.vue correctly 1`
-
+
+
@@ -403,7 +447,8 @@ exports[`renders ./components/date-picker/demo/presetted-ranges.vue correctly 1`
-
+
+
@@ -419,7 +464,8 @@ exports[`renders ./components/date-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -430,7 +476,8 @@ exports[`renders ./components/date-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -441,7 +488,8 @@ exports[`renders ./components/date-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -452,7 +500,8 @@ exports[`renders ./components/date-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -463,7 +512,8 @@ exports[`renders ./components/date-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -477,7 +527,8 @@ exports[`renders ./components/date-picker/demo/select-in-range.vue correctly 1`]
-
+
+
@@ -491,7 +542,8 @@ exports[`renders ./components/date-picker/demo/size.vue correctly 1`] = `
-
+
+
@@ -500,7 +552,8 @@ exports[`renders ./components/date-picker/demo/size.vue correctly 1`] = `
-
+
+
@@ -512,7 +565,8 @@ exports[`renders ./components/date-picker/demo/size.vue correctly 1`] = `
-
+
+
@@ -520,7 +574,8 @@ exports[`renders ./components/date-picker/demo/size.vue correctly 1`] = `
-
+
+
@@ -534,7 +589,8 @@ exports[`renders ./components/date-picker/demo/start-end.vue correctly 1`] = `
-
+
+
@@ -543,7 +599,8 @@ exports[`renders ./components/date-picker/demo/start-end.vue correctly 1`] = `
-
+
+
@@ -557,7 +614,8 @@ exports[`renders ./components/date-picker/demo/suffix.vue correctly 1`] = `
-
+
+
@@ -566,7 +624,8 @@ exports[`renders ./components/date-picker/demo/suffix.vue correctly 1`] = `
-
+
+
@@ -578,7 +637,8 @@ exports[`renders ./components/date-picker/demo/suffix.vue correctly 1`] = `
-
+
+
@@ -586,7 +646,8 @@ exports[`renders ./components/date-picker/demo/suffix.vue correctly 1`] = `
-
+
+
@@ -642,14 +703,16 @@ exports[`renders ./components/date-picker/demo/switchable.vue correctly 1`] = `
Time -
+
-
+
+
@@ -663,7 +726,8 @@ exports[`renders ./components/date-picker/demo/text.vue correctly 1`] = `
-
+
+
@@ -675,7 +739,8 @@ exports[`renders ./components/date-picker/demo/text.vue correctly 1`] = `
-
+
+
@@ -688,7 +753,8 @@ exports[`renders ./components/date-picker/demo/time.vue correctly 1`] = `
-
+
+
@@ -700,7 +766,8 @@ exports[`renders ./components/date-picker/demo/time.vue correctly 1`] = `
-
+
+
diff --git a/components/empty/__tests__/__snapshots__/demo.test.js.snap b/components/empty/__tests__/__snapshots__/demo.test.js.snap index 9a019f818..0726745bb 100644 --- a/components/empty/__tests__/__snapshots__/demo.test.js.snap +++ b/components/empty/__tests__/__snapshots__/demo.test.js.snap @@ -39,7 +39,8 @@ exports[`renders ./components/empty/demo/config-provider.vue correctly 1`] = `
-
+

TreeSelect

@@ -48,7 +49,8 @@ exports[`renders ./components/empty/demo/config-provider.vue correctly 1`] = `
-
+

Cascader

@@ -57,7 +59,8 @@ exports[`renders ./components/empty/demo/config-provider.vue correctly 1`] = `
-
+

Transfer

diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 99acb9a49..fb1ee9488 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -11,8 +11,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -26,8 +25,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -41,8 +39,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -56,8 +53,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -71,8 +67,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -86,8 +81,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -101,8 +95,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -116,8 +109,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -131,8 +123,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -146,8 +137,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
- +
@@ -175,8 +165,7 @@ exports[`renders ./components/form/demo/basic.vue correctly 1`] = `
-
- +
@@ -188,8 +177,9 @@ exports[`renders ./components/form/demo/basic.vue correctly 1`] = `
-
- +
+ +
@@ -199,8 +189,7 @@ exports[`renders ./components/form/demo/basic.vue correctly 1`] = `
-
- +
@@ -213,7 +202,6 @@ exports[`renders ./components/form/demo/basic.vue correctly 1`] = `
-
@@ -230,8 +218,7 @@ exports[`renders ./components/form/demo/custom-validation.vue correctly 1`] = `
-
- +
@@ -243,8 +230,7 @@ exports[`renders ./components/form/demo/custom-validation.vue correctly 1`] = `
-
- +
@@ -257,12 +243,14 @@ exports[`renders ./components/form/demo/custom-validation.vue correctly 1`] = `
-
-
-
+
+ +
+
+
+
-
@@ -277,7 +265,6 @@ exports[`renders ./components/form/demo/custom-validation.vue correctly 1`] = `
-
@@ -294,13 +281,13 @@ exports[`renders ./components/form/demo/customized-form-controls.vue correctly 1
-
RMB +
RMB -
+
-
@@ -313,7 +300,6 @@ exports[`renders ./components/form/demo/customized-form-controls.vue correctly 1
-
@@ -331,7 +317,6 @@ exports[`renders ./components/form/demo/dynamic-form-item.vue correctly 1`] = `
-
@@ -346,7 +331,6 @@ exports[`renders ./components/form/demo/dynamic-form-item.vue correctly 1`] = `
-
@@ -364,7 +348,6 @@ exports[`renders ./components/form/demo/dynamic-form-items.vue correctly 1`] = `
-
@@ -377,7 +360,6 @@ exports[`renders ./components/form/demo/dynamic-form-items.vue correctly 1`] = `
-
@@ -395,16 +377,16 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.vue correctly
-
+
-
+
-
@@ -417,7 +399,6 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.vue correctly
-
@@ -430,7 +411,6 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.vue correctly
-
@@ -447,8 +427,7 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
- +
@@ -460,8 +439,7 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
- +
@@ -471,8 +449,7 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
- +
@@ -485,7 +462,6 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
@@ -502,8 +478,7 @@ exports[`renders ./components/form/demo/form-context.vue correctly 1`] = `
-
- +
@@ -518,7 +493,6 @@ exports[`renders ./components/form/demo/form-context.vue correctly 1`] = `
( No user yet. )
-
@@ -533,7 +507,6 @@ exports[`renders ./components/form/demo/form-context.vue correctly 1`] = `
-
@@ -556,8 +529,9 @@ exports[`renders ./components/form/demo/horizontal-login.vue correctly 1`] = `
-
- +
+ +
@@ -567,8 +541,9 @@ exports[`renders ./components/form/demo/horizontal-login.vue correctly 1`] = `
-
- +
+ +
@@ -581,7 +556,6 @@ exports[`renders ./components/form/demo/horizontal-login.vue correctly 1`] = `
-
@@ -598,8 +572,9 @@ exports[`renders ./components/form/demo/inline-login.vue correctly 1`] = `
-
- +
+ +
@@ -611,8 +586,9 @@ exports[`renders ./components/form/demo/inline-login.vue correctly 1`] = `
-
- +
+ +
@@ -625,7 +601,6 @@ exports[`renders ./components/form/demo/inline-login.vue correctly 1`] = `
-
@@ -643,7 +618,6 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
@@ -660,7 +634,6 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
@@ -673,9 +646,8 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
+
-
@@ -688,9 +660,8 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
+
-
@@ -703,7 +674,6 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
@@ -718,7 +688,6 @@ exports[`renders ./components/form/demo/lable-width.vue correctly 1`] = `
-
@@ -736,9 +705,8 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
+
-
@@ -751,7 +719,6 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
@@ -764,7 +731,6 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
@@ -777,7 +743,6 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
@@ -794,8 +759,7 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
- +
@@ -807,8 +771,7 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
- +
@@ -821,12 +784,11 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
+
-
@@ -838,8 +800,7 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
- +
@@ -852,7 +813,6 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
@@ -865,7 +825,6 @@ exports[`renders ./components/form/demo/nest-messages.vue correctly 1`] = `
-
@@ -882,8 +841,9 @@ exports[`renders ./components/form/demo/normal-login.vue correctly 1`] = `
-
- +
+ +
@@ -895,14 +855,15 @@ exports[`renders ./components/form/demo/normal-login.vue correctly 1`] = `
-
- +
+ +
- +
@@ -910,7 +871,6 @@ exports[`renders ./components/form/demo/normal-login.vue correctly 1`] = `
Or register now!
-
@@ -929,13 +889,13 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -949,13 +909,13 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -969,13 +929,13 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -992,12 +952,12 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -1014,12 +974,12 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -1033,13 +993,13 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
+
+
-
@@ -1052,7 +1012,6 @@ exports[`renders ./components/form/demo/time-related-controls.vue correctly 1`]
-
@@ -1070,7 +1029,6 @@ exports[`renders ./components/form/demo/useForm-basic.vue correctly 1`] = `
-
@@ -1083,16 +1041,16 @@ exports[`renders ./components/form/demo/useForm-basic.vue correctly 1`] = `
-
+
please select your zone -
+
-
@@ -1105,9 +1063,8 @@ exports[`renders ./components/form/demo/useForm-basic.vue correctly 1`] = `
-
+
-
@@ -1122,7 +1079,6 @@ exports[`renders ./components/form/demo/useForm-basic.vue correctly 1`] = `
-
@@ -1140,7 +1096,6 @@ exports[`renders ./components/form/demo/useForm-merge.vue correctly 1`] = `
-
@@ -1153,16 +1108,16 @@ exports[`renders ./components/form/demo/useForm-merge.vue correctly 1`] = `
-
+
please select your zone -
+
-
@@ -1175,9 +1130,8 @@ exports[`renders ./components/form/demo/useForm-merge.vue correctly 1`] = `
-
+
-
@@ -1192,7 +1146,6 @@ exports[`renders ./components/form/demo/useForm-merge.vue correctly 1`] = `
-
@@ -1210,7 +1163,6 @@ exports[`renders ./components/form/demo/useForm-nested.vue correctly 1`] = `
-
@@ -1223,7 +1175,6 @@ exports[`renders ./components/form/demo/useForm-nested.vue correctly 1`] = `
-
@@ -1238,7 +1189,6 @@ exports[`renders ./components/form/demo/useForm-nested.vue correctly 1`] = `
-
@@ -1256,7 +1206,6 @@ exports[`renders ./components/form/demo/useForm-trigger.vue correctly 1`] = `
-
@@ -1269,16 +1218,16 @@ exports[`renders ./components/form/demo/useForm-trigger.vue correctly 1`] = `
-
+
please select your zone -
+
-
@@ -1293,7 +1242,6 @@ exports[`renders ./components/form/demo/useForm-trigger.vue correctly 1`] = `
-
@@ -1311,7 +1259,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
China
-
@@ -1324,16 +1271,16 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
+
Please select a country -
+
-
@@ -1346,7 +1293,7 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
- @@ -1375,12 +1321,11 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
+
machines
-
@@ -1397,7 +1342,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
@@ -1419,7 +1363,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
ABCDEF
-
@@ -1432,9 +1375,8 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
+
-
@@ -1447,9 +1389,8 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
+
-
@@ -1464,16 +1405,15 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
-
-
-
-
-
+
+
+
+
+
+
-
@@ -1519,7 +1459,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
@@ -1536,7 +1475,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
longgggggggggggggggggggggggggggggggggg
@@ -1556,7 +1494,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
@@ -1569,7 +1506,6 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
@@ -1586,8 +1522,7 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
- +
@@ -1600,16 +1535,16 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
+
please select your zone -
+
-
@@ -1623,13 +1558,13 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
+
+
-
@@ -1646,7 +1581,6 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
@@ -1659,9 +1593,8 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
+
-
@@ -1674,9 +1607,8 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
+
-
@@ -1689,7 +1621,6 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
@@ -1704,7 +1635,6 @@ exports[`renders ./components/form/demo/validation.vue correctly 1`] = `
-
diff --git a/components/input-number/__tests__/__snapshots__/demo.test.js.snap b/components/input-number/__tests__/__snapshots__/demo.test.js.snap index eee67f296..216be4a3a 100644 --- a/components/input-number/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input-number/__tests__/__snapshots__/demo.test.js.snap @@ -24,7 +24,8 @@ exports[`renders ./components/input-number/demo/addon.vue correctly 1`] = `
+ -
+
@@ -38,7 +39,8 @@ exports[`renders ./components/input-number/demo/addon.vue correctly 1`] = `
$ -
+
@@ -73,7 +75,8 @@ exports[`renders ./components/input-number/demo/addon.vue correctly 1`] = `
cascader -
+
@@ -176,6 +179,7 @@ exports[`renders ./components/input-number/demo/prefix.vue correctly 1`] = `
+


@@ -187,6 +191,7 @@ exports[`renders ./components/input-number/demo/prefix.vue correctly 1`] = `
+
@@ -198,6 +203,7 @@ exports[`renders ./components/input-number/demo/prefix.vue correctly 1`] = `
+
`; diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index a65d213eb..8efc58b7f 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -6,11 +6,13 @@ exports[`renders ./components/input/demo/addon.vue correctly 1`] = `
Http:// -
+
.com -
+
@@ -18,7 +20,8 @@ exports[`renders ./components/input/demo/addon.vue correctly 1`] = `
cascader -
+
@@ -27,7 +30,7 @@ exports[`renders ./components/input/demo/addon.vue correctly 1`] = ` `; exports[`renders ./components/input/demo/allow-clear.vue correctly 1`] = ` -
+


`; @@ -45,19 +48,23 @@ exports[`renders ./components/input/demo/borderless.vue correctly 1`] = `


Zhejiang -
+

Option1 -
+
-

+

+

Option1-1 -
+
@@ -65,15 +72,18 @@ exports[`renders ./components/input/demo/group.vue correctly 1`] = `
Option2-2 -
+

Between -
+
-

Sign Up +

Sign Up -
+

Home -
+
@@ -94,14 +105,22 @@ exports[`renders ./components/input/demo/group.vue correctly 1`] = `
Select Address -
+


`; -exports[`renders ./components/input/demo/password-input.vue correctly 1`] = ``; +exports[`renders ./components/input/demo/password-input.vue correctly 1`] = ` + + +`; -exports[`renders ./components/input/demo/presuffix.vue correctly 1`] = `


RMB
`; +exports[`renders ./components/input/demo/presuffix.vue correctly 1`] = ` +
+

RMB +
+`; exports[`renders ./components/input/demo/search-input.vue correctly 1`] = `
@@ -109,9 +128,9 @@ exports[`renders ./components/input/demo/search-input.vue correctly 1`] = `
-
+
-
+
`; @@ -123,7 +142,9 @@ exports[`renders ./components/input/demo/show-count.vue correctly 1`] = `

-
+
+ +
`; exports[`renders ./components/input/demo/size.vue correctly 1`] = `
`; diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index 9aa3e5b87..c8f7be6ad 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -103,7 +103,13 @@ exports[`renders ./components/layout/demo/fixed.vue correctly 1`] = `
-
Home/List/App/
+
Content
Ant Design ©2018 Created by Ant UED
@@ -266,7 +272,12 @@ exports[`renders ./components/layout/demo/side.vue correctly 1`] = `
-
User/Bill/
+
Bill is a cat.
Ant Design ©2018 Created by Ant UED
@@ -303,7 +314,13 @@ exports[`renders ./components/layout/demo/top.vue correctly 1`] = `
-
Home/List/App/
+
Content
Ant Design ©2018 Created by Ant UED
@@ -339,7 +356,13 @@ exports[`renders ./components/layout/demo/top-side.vue correctly 1`] = `
-
Home/List/App/
+
-
Home/List/App/
+
Content
diff --git a/components/mentions/__tests__/__snapshots__/demo.test.js.snap b/components/mentions/__tests__/__snapshots__/demo.test.js.snap index 53e2b8c5d..1e0a9c271 100644 --- a/components/mentions/__tests__/__snapshots__/demo.test.js.snap +++ b/components/mentions/__tests__/__snapshots__/demo.test.js.snap @@ -25,7 +25,6 @@ exports[`renders ./components/mentions/demo/form.vue correctly 1`] = `
-
@@ -42,7 +41,6 @@ exports[`renders ./components/mentions/demo/form.vue correctly 1`] = `
-
@@ -57,7 +55,6 @@ exports[`renders ./components/mentions/demo/form.vue correctly 1`] = `
-
diff --git a/components/page-header/__tests__/__snapshots__/demo.test.js.snap b/components/page-header/__tests__/__snapshots__/demo.test.js.snap index 7ef6e476f..01b0ddcf5 100644 --- a/components/page-header/__tests__/__snapshots__/demo.test.js.snap +++ b/components/page-header/__tests__/__snapshots__/demo.test.js.snap @@ -65,47 +65,74 @@ exports[`renders ./components/page-header/demo/actions.vue correctly 1`] = ` - - - +
- - Operation - +
+ +
+ - - +
- - Primary - - - - +
- - - +
- - Operation - +
+ +
+ - - +
- - Primary - - - - +
-
- - - - - - First-level Menu - - - - - / - - - - - - - Second-level Menu - - - - - / - - - - - - - Third-level Menu - - - - - / - - - -
-
-
- - - - Title - - - This is a subtitle - - -
- -
- - -
-`; - -exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` -
-
-
+
    - +
  1. @@ -674,8 +635,8 @@ exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` > / - - +
  2. +
  3. @@ -692,8 +653,8 @@ exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` > / - - +
  4. +
  5. @@ -708,9 +669,106 @@ exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` > / - +
  6. +
+ +
+
+ + + + Title + + + This is a subtitle + +
+ +
+ + +
+`; + +exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` +
+
+
@@ -755,82 +813,117 @@ exports[`renders ./components/page-header/demo/content.vue correctly 1`] = ` - - - +
- - Operation - - - - +
- - Primary - - - - - - +
- - - + + + + + + + + + + +
+ - - - + +
- - - +
- - Operation - +
+ +
+ - - +
- - Primary - - - - +
- - - +
- - Operation - +
+ +
+ - - +
- - Primary - - - - +
20 / page -
+
@@ -61,7 +62,8 @@ exports[`renders ./components/pagination/demo/changer.vue correctly 1`] = `
10 / page -
+
@@ -86,7 +88,8 @@ exports[`renders ./components/pagination/demo/custom-changer.vue correctly 1`] =
10条/页 -
+ @@ -114,7 +117,8 @@ exports[`renders ./components/pagination/demo/itemRender.vue correctly 1`] = `
10 / page -
+ @@ -143,7 +147,8 @@ exports[`renders ./components/pagination/demo/jump.vue correctly 1`] = `
10 / page -
+
Go to @@ -168,7 +173,8 @@ exports[`renders ./components/pagination/demo/jump.vue correctly 1`] = `
10 / page -
+
Go to @@ -207,7 +213,8 @@ exports[`renders ./components/pagination/demo/mini.vue correctly 1`] = `
10 / page -
+
Go to @@ -253,7 +260,8 @@ exports[`renders ./components/pagination/demo/more.vue correctly 1`] = `
10 / page -
+
@@ -287,7 +295,8 @@ exports[`renders ./components/pagination/demo/total.vue correctly 1`] = `
20 / page -
+ @@ -308,7 +317,8 @@ exports[`renders ./components/pagination/demo/total.vue correctly 1`] = `
20 / page -
+ diff --git a/components/radio/__tests__/group.test.js b/components/radio/__tests__/group.test.js index 17bcccd0a..4b13d05a4 100644 --- a/components/radio/__tests__/group.test.js +++ b/components/radio/__tests__/group.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '../../../tests/utils'; +import { sleep } from '../../../tests/utils'; import Radio from '../Radio'; import RadioGroup from '../Group'; @@ -62,26 +62,21 @@ describe('Radio', () => { const props = { onChange }; const wrapper = mount(createRadioGroup(props), { sync: false }); let radios = null; - await asyncExpect(() => { - radios = wrapper.findAll('input'); - // uncontrolled component - wrapper.vm.$refs.radioGroup.stateValue = 'B'; - // wrapper.setData({ value: 'B' }) - radios[0].trigger('change'); - expect(onChange.mock.calls.length).toBe(1); - }); - await asyncExpect(() => { - expect(wrapper.html()).toMatchSnapshot(); - }); - await asyncExpect(() => { - // controlled component - wrapper.setProps({ value: 'A' }); - radios[1].trigger('change'); - expect(onChange.mock.calls.length).toBe(2); - }); - await asyncExpect(() => { - expect(wrapper.html()).toMatchSnapshot(); - }); + await sleep(); + radios = wrapper.findAll('input'); + // uncontrolled component + wrapper.vm.$refs.radioGroup.stateValue = 'B'; + // wrapper.setData({ value: 'B' }) + radios[0].trigger('change'); + expect(onChange.mock.calls.length).toBe(1); + await sleep(); + expect(wrapper.html()).toMatchSnapshot(); + // controlled component + wrapper.setProps({ value: 'A' }); + radios[1].trigger('change'); + expect(onChange.mock.calls.length).toBe(2); + await sleep(); + expect(wrapper.html()).toMatchSnapshot(); }); it('both of radio and radioGroup will trigger onchange event when they exists', async () => { @@ -138,12 +133,11 @@ describe('Radio', () => { radios[0].trigger('change'); expect(onChange.mock.calls.length).toBe(1); - asyncExpect(() => { - // controlled component - wrapper.setProps({ value: 'A' }); - radios[1].trigger('change'); - expect(onChange.mock.calls.length).toBe(2); - }); + await sleep(); + // controlled component + wrapper.setProps({ value: 'A' }); + radios[1].trigger('change'); + expect(onChange.mock.calls.length).toBe(2); }); // it('should only trigger once when in group with options', () => { @@ -215,7 +209,7 @@ describe('Radio', () => { expect(wrapper.html()).toMatchSnapshot(); }); - it('when onChange do not change the value, change event can be also triggered.', async () => { + fit('when onChange do not change the value, change event can be also triggered.', async () => { const onChange = jest.fn(); const onChangeRadioGroup = () => { onChange(); @@ -238,17 +232,11 @@ describe('Radio', () => { }, { sync: false }, ); - + await sleep(); const radios = wrapper.findAll('input'); - - await asyncExpect(() => { - radios[1].trigger('click'); - expect(onChange.mock.calls.length).toBe(1); - }); - - await asyncExpect(() => { - radios[1].trigger('click'); - expect(onChange.mock.calls.length).toBe(2); - }); + radios[1].trigger('click'); + radios[1].trigger('change'); + await sleep(10); + expect(onChange).toHaveBeenCalled(); }); }); diff --git a/components/select/__tests__/__snapshots__/demo.test.js.snap b/components/select/__tests__/__snapshots__/demo.test.js.snap index eeeb24b7f..456d7fe54 100644 --- a/components/select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/select/__tests__/__snapshots__/demo.test.js.snap @@ -27,7 +27,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -38,7 +39,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -49,7 +51,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -63,7 +66,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -74,7 +78,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -85,7 +90,8 @@ exports[`renders ./components/select/demo/basic.vue correctly 1`] = `
Lucy -
+ @@ -125,7 +131,8 @@ exports[`renders ./components/select/demo/coordinate.vue correctly 1`] = `
Zhejiang -
+ @@ -136,7 +143,8 @@ exports[`renders ./components/select/demo/coordinate.vue correctly 1`] = `
Hangzhou -
+ @@ -150,7 +158,8 @@ exports[`renders ./components/select/demo/custom-dropdown-menu.vue correctly 1`]
lucy -
+ `; @@ -161,7 +170,8 @@ exports[`renders ./components/select/demo/field-names.vue correctly 1`] = `
Lucy -
+ `; @@ -190,7 +200,8 @@ exports[`renders ./components/select/demo/label-in-value.vue correctly 1`] = `
Lucy (101) -
+ `; @@ -224,7 +235,8 @@ exports[`renders ./components/select/demo/optgroup.vue correctly 1`] = `
Lucy -
+ @@ -235,7 +247,8 @@ exports[`renders ./components/select/demo/optgroup.vue correctly 1`] = `
Lucy -
+ @@ -433,7 +446,8 @@ exports[`renders ./components/select/demo/search.vue correctly 1`] = `
Select a person -
+ `; @@ -479,7 +493,8 @@ exports[`renders ./components/select/demo/size.vue correctly 1`] = `
a1 -
+ @@ -537,7 +552,8 @@ exports[`renders ./components/select/demo/suffix.vue correctly 1`] = `
Lucy -
+ @@ -548,7 +564,8 @@ exports[`renders ./components/select/demo/suffix.vue correctly 1`] = `
Lucy -
+ diff --git a/components/skeleton/__tests__/__snapshots__/demo.test.js.snap b/components/skeleton/__tests__/__snapshots__/demo.test.js.snap index bf28685ec..2f70399bc 100644 --- a/components/skeleton/__tests__/__snapshots__/demo.test.js.snap +++ b/components/skeleton/__tests__/__snapshots__/demo.test.js.snap @@ -94,7 +94,6 @@ exports[`renders ./components/skeleton/demo/element.vue correctly 1`] = ` - @@ -111,7 +110,6 @@ exports[`renders ./components/skeleton/demo/element.vue correctly 1`] = ` - @@ -124,9 +122,8 @@ exports[`renders ./components/skeleton/demo/element.vue correctly 1`] = `
-
+
-
@@ -139,9 +136,8 @@ exports[`renders ./components/skeleton/demo/element.vue correctly 1`] = `
-
+
-
@@ -154,9 +150,8 @@ exports[`renders ./components/skeleton/demo/element.vue correctly 1`] = `
-
+
-
diff --git a/components/spin/__tests__/__snapshots__/demo.test.js.snap b/components/spin/__tests__/__snapshots__/demo.test.js.snap index 1abfbb95d..25ababc09 100644 --- a/components/spin/__tests__/__snapshots__/demo.test.js.snap +++ b/components/spin/__tests__/__snapshots__/demo.test.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./components/spin/demo/basic.vue correctly 1`] = ` -
+
`; exports[`renders ./components/spin/demo/custom-indicator.vue correctly 1`] = ` -
+
`; @@ -35,7 +35,7 @@ exports[`renders ./components/spin/demo/delay.vue correctly 1`] = ` exports[`renders ./components/spin/demo/inside.vue correctly 1`] = `
-
+
@@ -65,19 +65,19 @@ exports[`renders ./components/spin/demo/nested.vue correctly 1`] = ` exports[`renders ./components/spin/demo/size.vue correctly 1`] = `
-
+
-
+
-
+
@@ -88,7 +88,7 @@ exports[`renders ./components/spin/demo/size.vue correctly 1`] = ` exports[`renders ./components/spin/demo/tip.vue correctly 1`] = `
-
+
Loading...
diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index f5d882d7c..5a9672c71 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -886,7 +886,8 @@ exports[`renders ./components/table/demo/edit-row.vue correctly 1`] = `
10 / page -
+
@@ -1320,7 +1321,7 @@ exports[`renders ./components/table/demo/filter-in-tree.vue correctly 1`] = `
- +
Age
@@ -2255,7 +2256,8 @@ exports[`renders ./components/table/demo/fixed-columns-header.vue correctly 1`]
10 / page -
+
@@ -3085,7 +3087,8 @@ exports[`renders ./components/table/demo/fixed-header.vue correctly 1`] = `
50 / page -
+
@@ -3130,7 +3133,7 @@ exports[`renders ./components/table/demo/grouping-columns.vue correctly 1`] = ` - +
Age
@@ -3590,7 +3593,8 @@ exports[`renders ./components/table/demo/grouping-columns.vue correctly 1`] = `
10 / page -
+
@@ -3614,20 +3618,20 @@ exports[`renders ./components/table/demo/head.vue correctly 1`] = ` - +
Name
- +
Age
- +
Address
@@ -3734,19 +3738,19 @@ exports[`renders ./components/table/demo/multiple-sorter.vue correctly 1`] = ` Name - +
Chinese Score
- +
Math Score
- +
English Score
@@ -4213,20 +4217,20 @@ exports[`renders ./components/table/demo/reset-filter.vue correctly 1`] = ` - +
Name
- +
Age
- +
Address
@@ -6013,7 +6017,8 @@ exports[`renders ./components/table/demo/sticky.vue correctly 1`] = `
10 / page -
+
diff --git a/components/tabs/__tests__/__snapshots__/demo.test.js.snap b/components/tabs/__tests__/__snapshots__/demo.test.js.snap index 9fe03ccac..4eb5e3a3d 100644 --- a/components/tabs/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tabs/__tests__/__snapshots__/demo.test.js.snap @@ -466,6 +466,50 @@ exports[`renders ./components/tabs/demo/position.vue correctly 1`] = ` `; exports[`renders ./components/tabs/demo/size.vue correctly 1`] = ` +
+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+ + +
+ + +
+
+
+
Content of Tab 1
+ + +
+
+
+`; + +exports[`renders ./components/tabs/demo/size.vue correctly 2`] = `
diff --git a/components/time-picker/__tests__/__snapshots__/demo.test.js.snap b/components/time-picker/__tests__/__snapshots__/demo.test.js.snap index 4c850a5b5..f241c4f2a 100644 --- a/components/time-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/time-picker/__tests__/__snapshots__/demo.test.js.snap @@ -4,7 +4,8 @@ exports[`renders ./components/time-picker/demo/12hours.vue correctly 1`] = `
-
+
+
@@ -13,7 +14,8 @@ exports[`renders ./components/time-picker/demo/12hours.vue correctly 1`] = `
-
+
+
@@ -22,7 +24,8 @@ exports[`renders ./components/time-picker/demo/12hours.vue correctly 1`] = `
-
+
+
@@ -36,7 +39,8 @@ exports[`renders ./components/time-picker/demo/addon.vue correctly 1`] = `
-
+
+
@@ -45,7 +49,8 @@ exports[`renders ./components/time-picker/demo/addon.vue correctly 1`] = `
-
+
+
@@ -59,14 +64,18 @@ exports[`renders ./components/time-picker/demo/basic.vue correctly 1`] = `
-
+
+ +
-
+
+ +
@@ -78,7 +87,8 @@ exports[`renders ./components/time-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -90,7 +100,8 @@ exports[`renders ./components/time-picker/demo/bordered.vue correctly 1`] = `
-
+
+
@@ -101,7 +112,8 @@ exports[`renders ./components/time-picker/demo/bordered.vue correctly 1`] = ` exports[`renders ./components/time-picker/demo/disabled.vue correctly 1`] = `
-
+
+
@@ -110,14 +122,17 @@ exports[`renders ./components/time-picker/demo/disabled.vue correctly 1`] = ` exports[`renders ./components/time-picker/demo/hide-column.vue correctly 1`] = `
-
+
+ +
`; exports[`renders ./components/time-picker/demo/interval-options.vue correctly 1`] = `
-
+
+
@@ -129,7 +144,8 @@ exports[`renders ./components/time-picker/demo/range-picker.vue correctly 1`] =
-
+
+
@@ -139,21 +155,27 @@ exports[`renders ./components/time-picker/demo/size.vue correctly 1`] = `
-
+
+ +
-
+
+ +
-
+
+ +
@@ -163,7 +185,9 @@ exports[`renders ./components/time-picker/demo/size.vue correctly 1`] = ` exports[`renders ./components/time-picker/demo/suffix.vue correctly 1`] = `
-
+
+ +
`; @@ -176,7 +200,8 @@ exports[`renders ./components/time-picker/demo/value.vue correctly 1`] = `
-
+
+
@@ -189,7 +214,8 @@ exports[`renders ./components/time-picker/demo/value.vue correctly 1`] = `
-
+
+
@@ -202,7 +228,9 @@ exports[`renders ./components/time-picker/demo/value.vue correctly 1`] = `
-
+
+ +
diff --git a/components/transfer/__tests__/__snapshots__/demo.test.js.snap b/components/transfer/__tests__/__snapshots__/demo.test.js.snap index 36b401be3..872ec9d44 100644 --- a/components/transfer/__tests__/__snapshots__/demo.test.js.snap +++ b/components/transfer/__tests__/__snapshots__/demo.test.js.snap @@ -9,7 +9,7 @@ exports[`renders ./components/transfer/demo/advanced.vue correctly 1`] = ` 20 items
@@ -155,7 +161,8 @@ exports[`renders ./components/tree-select/demo/tree-line.vue correctly 1`] = `
Please select -
+
diff --git a/package.json b/package.json index 5b70cdd5f..e9b797160 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "@rollup/plugin-babel": "^5.3.0", "@types/compression": "^1.7.0", "@types/fs-extra": "^9.0.8", - "@types/jest": "^26.0.15", + "@types/jest": "^28.1.4", "@types/koa": "^2.11.6", "@types/lodash-es": "^4.17.3", "@types/lru-cache": "^5.1.0", @@ -128,7 +128,8 @@ "@vue/compiler-sfc": "^3.2.0", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^9.0.0", - "@vue/test-utils": "^2.0.0-0", + "@vue/test-utils": "^2.0.2", + "@vue/vue3-jest": "28", "@vueuse/core": "^8.3.1", "@webpack-cli/serve": "^1.3.1", "acorn": "^8.0.0", @@ -136,7 +137,7 @@ "autoprefixer": "^10.2.0", "axios": "^0.22.0", "babel-eslint": "^10.0.1", - "babel-jest": "^26.1.0", + "babel-jest": "^28.1.2", "babel-loader": "^8.0.0", "babel-plugin-import": "^1.1.1", "babel-plugin-inline-import-data-uri": "^1.0.1", @@ -184,8 +185,9 @@ "husky": "^6.0.0", "ignore-emit-webpack-plugin": "^2.0.6", "is-windows": "^1.0.2", - "jest": "^26.0.0", - "jest-environment-jsdom-fifteen": "^1.0.2", + "jest": "^28.1.2", + "jest-environment-jsdom": "^28.0.0", + "jest-environment-node": "^28.0.2", "jest-serializer-vue": "^2.0.0", "jest-transform-stub": "^2.0.0", "js-base64": "^3.0.0", @@ -239,7 +241,7 @@ "stylelint-order": "^5.0.0", "terser-webpack-plugin": "^5.1.1", "through2": "^3.0.0", - "ts-jest": "^26.4.1", + "ts-jest": "^28.0.5", "ts-loader": "^9.1.0", "typescript": "~4.5.2", "umi-request": "^1.3.5", @@ -252,7 +254,6 @@ "vue-eslint-parser": "^8.0.0", "vue-i18n": "^9.1.7", "vue-infinite-scroll": "^2.0.2", - "vue-jest": "^5.0.0-alpha.3", "vue-loader": "^16.1.1", "vue-request": "^1.0.2", "vue-router": "^4.0.0", diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap index ae5d5d3a1..68c6aa400 100644 --- a/tests/__snapshots__/index.test.js.snap +++ b/tests/__snapshots__/index.test.js.snap @@ -2,16 +2,15 @@ exports[`antd dist files exports modules correctly 1`] = ` Array [ - "default", "install: { name: install }", "version", "Affix: { name: AAffix }", - "Alert: { name: AAlert }", "Anchor: { name: AAnchor }", "AnchorLink: { name: AAnchorLink }", "AutoComplete: { name: AAutoComplete }", "AutoCompleteOptGroup: { displayName: AAutoCompleteOptGroup }", "AutoCompleteOption: { displayName: AAutoCompleteOption }", + "Alert: { name: AAlert }", "Avatar: { name: AAvatar }", "AvatarGroup: { name: AAvatarGroup }", "BackTop: { name: ABackTop }", @@ -26,63 +25,67 @@ Array [ "Card: { name: ACard }", "CardGrid: { name: ACardGrid }", "CardMeta: { name: ACardMeta }", + "Collapse: { name: ACollapse }", + "CollapsePanel: { name: ACollapsePanel }", "Carousel: { name: ACarousel }", "Cascader: { name: ACascader }", - "CheckableTag: { name: ACheckableTag }", "Checkbox: { name: ACheckbox }", "CheckboxGroup: { name: ACheckboxGroup }", "Col: { name: ACol }", - "Collapse: { name: ACollapse }", - "CollapsePanel: { name: ACollapsePanel }", "Comment: { name: AComment }", "ConfigProvider: { name: AConfigProvider }", "DatePicker: { name: ADatePicker }", + "MonthPicker: { name: AMonthPicker }", + "WeekPicker: { name: AWeekPicker }", + "RangePicker: { name: ARangePicker }", + "QuarterPicker: { name: AQuarterPicker }", "Descriptions: { name: ADescriptions }", "DescriptionsItem: { name: ADescriptionsItem }", - "DirectoryTree: { name: ADirectoryTree }", "Divider: { name: ADivider }", - "Drawer: { name: ADrawer }", "Dropdown: { name: ADropdown }", "DropdownButton: { name: ADropdownButton }", + "Drawer: { name: ADrawer }", "Empty: { displayName: AEmpty }", "Form: { name: AForm }", "FormItem: { name: AFormItem }", "FormItemRest: { name: AFormItemRest }", "Grid", - "Image: { name: AImage }", - "ImagePreviewGroup: { name: AImagePreviewGroup }", "Input: { name: AInput }", "InputGroup: { name: AInputGroup }", - "InputNumber: { name: AInputNumber }", "InputPassword: { name: AInputPassword }", "InputSearch: { name: AInputSearch }", + "Textarea: { name: ATextarea }", + "Image: { name: AImage }", + "ImagePreviewGroup: { name: AImagePreviewGroup }", + "InputNumber: { name: AInputNumber }", "Layout: { name: ALayout }", - "LayoutContent: { name: ALayoutContent }", - "LayoutFooter: { name: ALayoutFooter }", "LayoutHeader: { name: ALayoutHeader }", "LayoutSider: { name: ALayoutSider }", + "LayoutFooter: { name: ALayoutFooter }", + "LayoutContent: { name: ALayoutContent }", "List: { name: AList }", "ListItem: { name: AListItem }", "ListItemMeta: { displayName: AListItemMeta }", - "LocaleProvider: { name: ALocaleProvider }", - "Mentions: { name: AMentions }", - "MentionsOption: { name: AMentionsOption }", + "message", "Menu: { name: AMenu }", "MenuDivider: { name: AMenuDivider }", "MenuItem: { name: AMenuItem }", "MenuItemGroup: { name: AMenuItemGroup }", + "SubMenu: { name: ASubMenu }", + "Mentions: { name: AMentions }", + "MentionsOption: { name: AMentionsOption }", "Modal: { name: AModal }", - "MonthPicker: { name: AMonthPicker }", + "Statistic: { name: AStatistic }", + "StatisticCountdown: { name: AStatisticCountdown }", + "notification", "PageHeader: { name: APageHeader }", "Pagination: { name: APagination }", "Popconfirm: { name: APopconfirm }", "Popover: { name: APopover }", "Progress: { name: AProgress }", - "QuarterPicker: { name: AQuarterPicker }", "Radio: { name: ARadio }", "RadioButton: { name: ARadioButton }", "RadioGroup: { name: ARadioGroup }", - "RangePicker: { name: ARangePicker }", "Rate: { name: ARate }", "Result: { name: AResult }", "Row: { name: ARow }", @@ -90,40 +93,38 @@ Array [ "SelectOptGroup: { displayName: ASelectOptGroup }", "SelectOption: { displayName: ASelectOption }", "Skeleton: { name: ASkeleton }", - "SkeletonAvatar: { name: ASkeletonAvatar }", "SkeletonButton: { name: ASkeletonButton }", - "SkeletonImage: { name: ASkeletonImage }", + "SkeletonAvatar: { name: ASkeletonAvatar }", "SkeletonInput: { name: ASkeletonInput }", + "SkeletonImage: { name: ASkeletonImage }", "SkeletonTitle: { name: SkeletonTitle }", "Slider: { name: ASlider }", "Space: { name: ASpace }", "Spin: { name: ASpin }", - "Statistic: { name: AStatistic }", - "StatisticCountdown: { name: AStatisticCountdown }", - "Step: { name: AStep }", "Steps: { name: ASteps }", - "SubMenu: { name: ASubMenu }", + "Step: { name: AStep }", "Switch: { name: ASwitch }", - "TabPane: { name: ATabPane }", "Table: { name: ATable }", "TableColumn: { name: ATableColumn }", "TableColumnGroup: { name: ATableColumnGroup }", "TableSummary: { name: ATableSummary }", - "TableSummaryCell: { name: ATableSummaryCell }", "TableSummaryRow: { name: ATableSummaryRow }", + "TableSummaryCell: { name: ATableSummaryCell }", + "Transfer: { name: ATransfer }", + "Tree: { name: ATree }", + "TreeNode: { name: ATreeNode }", + "DirectoryTree: { name: ADirectoryTree }", + "TreeSelect: { name: ATreeSelect }", + "TreeSelectNode: { displayName: ATreeSelectNode }", "Tabs: { name: ATabs }", + "TabPane: { name: ATabPane }", "Tag: { name: ATag }", - "Textarea: { name: ATextarea }", + "CheckableTag: { name: ACheckableTag }", "TimePicker: { name: ATimePicker }", "TimeRangePicker: { name: ATimeRangePicker }", "Timeline: { name: ATimeline }", "TimelineItem: { name: ATimelineItem }", "Tooltip: { name: ATooltip }", - "Transfer: { name: ATransfer }", - "Tree: { name: ATree }", - "TreeNode: { name: ATreeNode }", - "TreeSelect: { name: ATreeSelect }", - "TreeSelectNode: { displayName: ATreeSelectNode }", "Typography: { name: ATypography }", "TypographyLink: { displayName: ATypographyLink }", "TypographyParagraph: { displayName: ATypographyParagraph }", @@ -131,8 +132,7 @@ Array [ "TypographyTitle: { displayName: ATypographyTitle }", "Upload: { name: AUpload }", "UploadDragger: { name: AUploadDragger }", - "WeekPicker: { name: AWeekPicker }", - "message", - "notification", + "LocaleProvider: { name: ALocaleProvider }", + "default", ] `; diff --git a/tests/setup.js b/tests/setup.js index dcbc39b23..19ad0a598 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,4 +1,5 @@ import { config } from '@vue/test-utils'; +const util = require('util'); config.global.stubs = { transition: false, @@ -21,6 +22,17 @@ if (typeof window !== 'undefined') { })), }); } + + // ref: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom + // ref: https://github.com/jsdom/jsdom/issues/2524 + Object.defineProperty(window, 'TextEncoder', { + writable: true, + value: util.TextEncoder, + }); + Object.defineProperty(window, 'TextDecoder', { + writable: true, + value: util.TextDecoder, + }); } global.ResizeObserver = require('resize-observer-polyfill');