From 789647c60438025a2d092379ed5ca7d3b2f66e02 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Wed, 28 Oct 2020 15:31:45 +0800 Subject: [PATCH] test: update test & ts --- antdv-demo | 2 +- components/_util/BaseMixin.js | 3 +- components/_util/BaseMixin2.js | 3 +- components/_util/Portal.js | 4 +- components/anchor/Anchor.tsx | 6 +- components/anchor/AnchorLink.tsx | 4 +- components/avatar/Avatar.tsx | 8 +- components/back-top/index.tsx | 4 +- components/cascader/index.tsx | 7 -- components/checkbox/Checkbox.tsx | 4 +- components/date-picker/RangePicker.tsx | 4 +- components/date-picker/WeekPicker.tsx | 6 +- .../__snapshots__/RangePicker.test.js.snap | 2 +- components/date-picker/createPicker.tsx | 4 +- components/date-picker/wrapPicker.tsx | 4 +- components/form/FormItem.tsx | 4 +- components/input/Input.tsx | 6 +- components/input/ResizableTextArea.tsx | 4 +- components/input/TextArea.tsx | 6 +- components/layout/Sider.tsx | 4 +- .../__snapshots__/index.test.js.snap | 88 +++++++++---------- components/mentions/index.tsx | 4 +- .../__snapshots__/index.test.js.snap | 8 +- components/spin/Spin.tsx | 4 +- components/table/filterDropdown.tsx | 12 +-- components/transfer/list.tsx | 4 +- components/transfer/renderListBody.tsx | 4 +- components/upload/UploadList.tsx | 4 +- components/vc-select/OptionList.tsx | 2 +- components/vc-select/Select.tsx | 2 +- components/vc-select/generate.tsx | 6 +- tests/setup.js | 6 +- 32 files changed, 116 insertions(+), 117 deletions(-) diff --git a/antdv-demo b/antdv-demo index 9bb9cb5ae..4f6ebd031 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 9bb9cb5ae42a776adb2d3bf3242a473a9851b344 +Subproject commit 4f6ebd03190812369678c4dd383fdb4e98d6f6c1 diff --git a/components/_util/BaseMixin.js b/components/_util/BaseMixin.js index 1bf7c9c3c..eeec056e3 100644 --- a/components/_util/BaseMixin.js +++ b/components/_util/BaseMixin.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { getOptionProps } from './props-util'; export default { @@ -19,7 +20,7 @@ export default { if (this._.isMounted) { this.$forceUpdate(); } - this.$nextTick(() => { + nextTick(() => { callback && callback(); }); }, diff --git a/components/_util/BaseMixin2.js b/components/_util/BaseMixin2.js index 4d8007a3c..00446ed20 100644 --- a/components/_util/BaseMixin2.js +++ b/components/_util/BaseMixin2.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { getOptionProps } from './props-util'; export default { @@ -19,7 +20,7 @@ export default { if (this._.isMounted) { this.$forceUpdate(); } - this.$nextTick(() => { + nextTick(() => { callback && callback(); }); }, diff --git a/components/_util/Portal.js b/components/_util/Portal.js index 0fc276677..e0ca32114 100644 --- a/components/_util/Portal.js +++ b/components/_util/Portal.js @@ -1,5 +1,5 @@ import PropTypes from './vue-types'; -import { defineComponent, Teleport } from 'vue'; +import { defineComponent, nextTick, Teleport } from 'vue'; export default defineComponent({ name: 'Portal', @@ -18,7 +18,7 @@ export default defineComponent({ updated() { const { didUpdate } = this.$props; if (didUpdate) { - this.$nextTick(() => { + nextTick(() => { didUpdate(this.$props); }); } diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index a76522d4f..b718296e5 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject, provide } from 'vue'; +import { defineComponent, inject, nextTick, provide } from 'vue'; import PropTypes from '../_util/vue-types'; import classNames from '../_util/classNames'; import addEventListener from '../vc-util/Dom/addEventListener'; @@ -117,7 +117,7 @@ export default defineComponent({ }; }, mounted() { - this.$nextTick(() => { + nextTick(() => { const { getContainer } = this; this.scrollContainer = getContainer(); this.scrollEvent = addEventListener(this.scrollContainer, 'scroll', this.handleScroll); @@ -125,7 +125,7 @@ export default defineComponent({ }); }, updated() { - this.$nextTick(() => { + nextTick(() => { if (this.scrollEvent) { const { getContainer } = this; const currentContainer = getContainer(); diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 4a2578bfe..4997dbe49 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -1,4 +1,4 @@ -import { ComponentPublicInstance, defineComponent, inject } from 'vue'; +import { ComponentPublicInstance, defineComponent, inject, nextTick } from 'vue'; import PropTypes from '../_util/vue-types'; import { getComponent } from '../_util/props-util'; import classNames from '../_util/classNames'; @@ -32,7 +32,7 @@ export default defineComponent({ }, watch: { href(val, oldVal) { - this.$nextTick(() => { + nextTick(() => { this.antAnchor.unregisterLink(oldVal); this.antAnchor.registerLink(val); }); diff --git a/components/avatar/Avatar.tsx b/components/avatar/Avatar.tsx index 9eeabd45d..212bd57cf 100644 --- a/components/avatar/Avatar.tsx +++ b/components/avatar/Avatar.tsx @@ -1,5 +1,5 @@ import { tuple, VueNode } from '../_util/type'; -import { CSSProperties, defineComponent, inject, PropType } from 'vue'; +import { CSSProperties, defineComponent, inject, nextTick, PropType } from 'vue'; import { defaultConfigProvider } from '../config-provider'; import { getComponent } from '../_util/props-util'; import PropTypes from '../_util/vue-types'; @@ -40,7 +40,7 @@ export default defineComponent({ }, watch: { src() { - this.$nextTick(() => { + nextTick(() => { this.isImgExist = true; this.scale = 1; // force uodate for position @@ -49,13 +49,13 @@ export default defineComponent({ }, }, mounted() { - this.$nextTick(() => { + nextTick(() => { this.setScale(); this.isMounted = true; }); }, updated() { - this.$nextTick(() => { + nextTick(() => { this.setScale(); }); }, diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index 01596aef1..e3f91e4a7 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -1,4 +1,4 @@ -import { App, defineComponent, inject } from 'vue'; +import { App, defineComponent, inject, nextTick } from 'vue'; import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; import backTopTypes from './backTopTypes'; @@ -36,7 +36,7 @@ const BackTop = defineComponent({ }; }, mounted() { - this.$nextTick(() => { + nextTick(() => { const getTarget = this.target || getDefaultTarget; this.scrollEvent = addEventListener(getTarget(), 'scroll', this.handleScroll); this.handleScroll(); diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 4d401fd74..6a49e14ca 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -231,13 +231,6 @@ const Cascader = defineComponent({ flattenOptions: showSearch ? flattenTree(options, this.$props) : undefined, }; }, - // mounted() { - // this.$nextTick(() => { - // if (this.autofocus && !this.showSearch && !this.disabled) { - // this.$refs.picker.focus(); - // } - // }); - // }, watch: { value(val) { this.setState({ sValue: val || [] }); diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index b90cc3df2..6b2767509 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject } from 'vue'; +import { defineComponent, inject, nextTick } from 'vue'; import PropTypes from '../_util/vue-types'; import classNames from '../_util/classNames'; import VcCheckbox from '../vc-checkbox'; @@ -36,7 +36,7 @@ export default defineComponent({ watch: { value(value, prevValue) { - this.$nextTick(() => { + nextTick(() => { const { checkboxGroupContext: checkboxGroup = {} } = this; if (checkboxGroup.registerValue && checkboxGroup.cancelValue) { checkboxGroup.cancelValue(prevValue); diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index f36a6a795..1bff2f4c9 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -1,4 +1,4 @@ -import { CSSProperties, defineComponent, inject } from 'vue'; +import { CSSProperties, defineComponent, inject, nextTick } from 'vue'; import moment from 'moment'; import RangeCalendar from '../vc-calendar/src/RangeCalendar'; import VcDatePicker from '../vc-calendar/src/Picker'; @@ -136,7 +136,7 @@ export default defineComponent({ this.setState(state); }, sOpen(val, oldVal) { - this.$nextTick(() => { + nextTick(() => { if (!hasProp(this, 'open') && oldVal && !val) { this.focus(); } diff --git a/components/date-picker/WeekPicker.tsx b/components/date-picker/WeekPicker.tsx index 94088d9d4..2306d38aa 100644 --- a/components/date-picker/WeekPicker.tsx +++ b/components/date-picker/WeekPicker.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject } from 'vue'; +import { defineComponent, inject, nextTick } from 'vue'; import moment from 'moment'; import Calendar from '../vc-calendar'; import VcDatePicker from '../vc-calendar/src/Picker'; @@ -63,7 +63,7 @@ export default defineComponent({ this.prevState = { ...this.$data, ...state }; }, _open(val, oldVal) { - this.$nextTick(() => { + nextTick(() => { if (!hasProp(this, 'open') && oldVal && !val) { this.focus(); } @@ -74,7 +74,7 @@ export default defineComponent({ this.prevState = { ...this.$data }; }, updated() { - this.$nextTick(() => { + nextTick(() => { if (!hasProp(this, 'open') && this.prevState._open && !this._open) { this.focus(); } diff --git a/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap b/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap index da21fdb35..ffee840c4 100644 --- a/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`RangePicker show month panel according to value 1`] = ` -
~ +
~
diff --git a/components/date-picker/createPicker.tsx b/components/date-picker/createPicker.tsx index 1671b67b8..d282411e2 100644 --- a/components/date-picker/createPicker.tsx +++ b/components/date-picker/createPicker.tsx @@ -1,4 +1,4 @@ -import { CSSProperties, DefineComponent, defineComponent, inject } from 'vue'; +import { CSSProperties, DefineComponent, defineComponent, inject, nextTick } from 'vue'; import moment from 'moment'; import omit from 'lodash-es/omit'; import MonthCalendar from '../vc-calendar/src/MonthCalendar'; @@ -73,7 +73,7 @@ export default function createPicker

( this.setState(state); }, sOpen(val, oldVal) { - this.$nextTick(() => { + nextTick(() => { if (!hasProp(this, 'open') && oldVal && !val) { this.focus(); } diff --git a/components/date-picker/wrapPicker.tsx b/components/date-picker/wrapPicker.tsx index 460a671dc..dc9204c0d 100644 --- a/components/date-picker/wrapPicker.tsx +++ b/components/date-picker/wrapPicker.tsx @@ -1,4 +1,4 @@ -import { provide, inject, defineComponent, DefineComponent } from 'vue'; +import { provide, inject, defineComponent, DefineComponent, nextTick } from 'vue'; import TimePickerPanel from '../vc-time-picker/Panel'; import classNames from '../_util/classNames'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; @@ -74,7 +74,7 @@ export default function wrapPicker

( checkValidate('DatePicker', defaultValue, 'defaultValue', valueFormat); checkValidate('DatePicker', value, 'value', valueFormat); if (autofocus && !disabled) { - this.$nextTick(() => { + nextTick(() => { this.focus(); }); } diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index e734f58e2..a5368d08a 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -1,4 +1,4 @@ -import { inject, provide, PropType, defineComponent, computed } from 'vue'; +import { inject, provide, PropType, defineComponent, computed, nextTick } from 'vue'; import cloneDeep from 'lodash-es/cloneDeep'; import PropTypes from '../_util/vue-types'; import classNames from '../_util/classNames'; @@ -295,7 +295,7 @@ export default defineComponent({ prop.o[prop.k] = this.initialValue; } // reset validateDisabled after onFieldChange triggered - this.$nextTick(() => { + nextTick(() => { this.validateDisabled = false; }); }, diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 869f2adf6..042bbd0e2 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject, VNode, withDirectives } from 'vue'; +import { defineComponent, inject, nextTick, VNode, withDirectives } from 'vue'; import antInputDirective from '../_util/antInputDirective'; import classNames from '../_util/classNames'; import omit from 'omit.js'; @@ -76,7 +76,7 @@ export default defineComponent({ }, }, mounted() { - this.$nextTick(() => { + nextTick(() => { if (process.env.NODE_ENV === 'test') { if (this.autofocus) { this.focus(); @@ -129,7 +129,7 @@ export default defineComponent({ } else { this.$forceUpdate(); } - this.$nextTick(() => { + nextTick(() => { callback && callback(); }); }, diff --git a/components/input/ResizableTextArea.tsx b/components/input/ResizableTextArea.tsx index e6a0d347d..734254397 100644 --- a/components/input/ResizableTextArea.tsx +++ b/components/input/ResizableTextArea.tsx @@ -1,4 +1,4 @@ -import { PropType, VNode } from 'vue'; +import { nextTick, PropType, VNode } from 'vue'; import ResizeObserver from '../vc-resize-observer'; import omit from 'omit.js'; import classNames from '../_util/classNames'; @@ -55,7 +55,7 @@ const ResizableTextArea = defineComponent({ }, watch: { value() { - this.$nextTick(() => { + nextTick(() => { this.resizeTextarea(); }); }, diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 87de5a8f5..e407927d7 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject } from 'vue'; +import { defineComponent, inject, nextTick } from 'vue'; import ClearableLabeledInput from './ClearableLabeledInput'; import ResizableTextArea from './ResizableTextArea'; import inputProps from './inputProps'; @@ -40,7 +40,7 @@ export default defineComponent({ }, }, mounted() { - this.$nextTick(() => { + nextTick(() => { if (process.env.NODE_ENV === 'test') { if (this.autofocus) { this.focus(); @@ -55,7 +55,7 @@ export default defineComponent({ } else { this.$forceUpdate(); } - this.$nextTick(() => { + nextTick(() => { callback && callback(); }); }, diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index ca7651c36..a8f94a577 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -1,5 +1,5 @@ import classNames from '../_util/classNames'; -import { inject, provide, PropType, defineComponent } from 'vue'; +import { inject, provide, PropType, defineComponent, nextTick } from 'vue'; import PropTypes from '../_util/vue-types'; import { tuple } from '../_util/type'; import { getOptionProps, hasProp, getComponent, getSlot } from '../_util/props-util'; @@ -114,7 +114,7 @@ export default defineComponent({ }, mounted() { - this.$nextTick(() => { + nextTick(() => { if (this.mql) { this.mql.addListener(this.responsiveHandler); this.responsiveHandler(this.mql); diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index 187eb7c4c..1107dbca8 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -10434,7 +10434,7 @@ exports[`Locale Provider should display the text as hu 1`] = `

-
szept +
szept.
@@ -10976,7 +10976,7 @@ exports[`Locale Provider should display the text as hy 1`] = `
-
szept +
szept.
@@ -23468,7 +23468,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
28
@@ -23476,7 +23476,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
29
@@ -23484,7 +23484,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
30
@@ -23492,7 +23492,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
31
@@ -23500,7 +23500,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
01
@@ -23508,7 +23508,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
02
@@ -23516,7 +23516,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
03
@@ -23527,7 +23527,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
04
@@ -23535,7 +23535,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
05
@@ -23543,7 +23543,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
06
@@ -23551,7 +23551,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
07
@@ -23559,7 +23559,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
08
@@ -23567,7 +23567,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
09
@@ -23575,7 +23575,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
10
@@ -23586,7 +23586,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
11
@@ -23594,7 +23594,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
12
@@ -23602,7 +23602,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
13
@@ -23610,7 +23610,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
14
@@ -23618,7 +23618,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
15
@@ -23626,7 +23626,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
16
@@ -23634,7 +23634,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
17
@@ -23645,7 +23645,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
18
@@ -23653,7 +23653,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
19
@@ -23661,7 +23661,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
20
@@ -23669,7 +23669,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
21
@@ -23677,7 +23677,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
22
@@ -23685,7 +23685,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
23
@@ -23693,7 +23693,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
24
@@ -23704,7 +23704,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
25
@@ -23712,7 +23712,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
26
@@ -23720,7 +23720,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
27
@@ -23728,7 +23728,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
28
@@ -23736,7 +23736,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
29
@@ -23744,7 +23744,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
30
@@ -23752,7 +23752,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
01
@@ -23763,7 +23763,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
02
@@ -23771,7 +23771,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
03
@@ -23779,7 +23779,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
04
@@ -23787,7 +23787,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
05
@@ -23795,7 +23795,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
06
@@ -23803,7 +23803,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
07
@@ -23811,7 +23811,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- +
08
diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index e6425c4d0..938b3750a 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -1,4 +1,4 @@ -import { App, defineComponent, inject, PropType, VNodeTypes } from 'vue'; +import { App, defineComponent, inject, nextTick, PropType, VNodeTypes } from 'vue'; import classNames from '../_util/classNames'; import omit from 'omit.js'; import PropTypes from '../_util/vue-types'; @@ -91,7 +91,7 @@ const Mentions = defineComponent({ }; }, mounted() { - this.$nextTick(() => { + nextTick(() => { if (process.env.NODE_ENV === 'test') { if (this.autofocus) { this.focus(); diff --git a/components/slider/__tests__/__snapshots__/index.test.js.snap b/components/slider/__tests__/__snapshots__/index.test.js.snap index b692959c8..c7fa752fc 100644 --- a/components/slider/__tests__/__snapshots__/index.test.js.snap +++ b/components/slider/__tests__/__snapshots__/index.test.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Slider should show tooltip when hovering slider handler 1`] = ` -
-
+
+
@@ -29,8 +29,8 @@ exports[`Slider should show tooltip when hovering slider handler 1`] = ` `; exports[`Slider should show tooltip when hovering slider handler 2`] = ` -
-
+
+
diff --git a/components/spin/Spin.tsx b/components/spin/Spin.tsx index a7f89e8b5..54f20b4c2 100644 --- a/components/spin/Spin.tsx +++ b/components/spin/Spin.tsx @@ -1,4 +1,4 @@ -import { inject, cloneVNode, isVNode, defineComponent, VNode } from 'vue'; +import { inject, cloneVNode, isVNode, defineComponent, VNode, nextTick } from 'vue'; import debounce from 'lodash-es/debounce'; import { tuple } from '../_util/type'; import PropTypes from '../_util/vue-types'; @@ -61,7 +61,7 @@ export default defineComponent({ this.updateSpinning(); }, updated() { - this.$nextTick(() => { + nextTick(() => { this.debouncifyUpdateSpinning(); this.updateSpinning(); }); diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index d8183eadb..2af1295d5 100755 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -1,4 +1,4 @@ -import { watchEffect, reactive, defineComponent } from 'vue'; +import { watchEffect, reactive, defineComponent, nextTick } from 'vue'; import FilterFilled from '@ant-design/icons-vue/FilterFilled'; import Menu, { SubMenu, Item as MenuItem } from '../vc-menu'; import closest from 'dom-closest'; @@ -58,13 +58,13 @@ export default defineComponent({ mounted() { const { column } = this; - this.$nextTick(() => { + nextTick(() => { this.setNeverShown(column); }); }, updated() { const { column } = this; - this.$nextTick(() => { + nextTick(() => { this.setNeverShown(column); }); }, @@ -112,7 +112,7 @@ export default defineComponent({ // Call `setSelectedKeys` & `confirm` in the same time will make filter data not up to date // https://github.com/ant-design/ant-design/issues/12284 this.$forceUpdate(); - this.$nextTick(this.confirmFilter2); + nextTick(this.confirmFilter2); }, onVisibleChange(visible: boolean) { @@ -233,7 +233,7 @@ export default defineComponent({ }, render() { - const { sSelectedKeys: originSelectedKeys } = this; + const { sSelectedKeys: originSelectedKeys } = this as any; const { column, locale, prefixCls, dropdownPrefixCls, getPopupContainer } = this; // default multiple selection in filter dropdown const multiple = 'filterMultiple' in column ? column.filterMultiple : true; @@ -267,7 +267,7 @@ export default defineComponent({ class={dropdownMenuClass} onSelect={this.setSelectedKeys} onDeselect={this.setSelectedKeys} - selectedKeys={originSelectedKeys && originSelectedKeys.map(val => val)} + selectedKeys={originSelectedKeys} getPopupContainer={getPopupContainer} children={this.renderMenus(column.filters)} > diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx index c248f6361..dcd2bf250 100644 --- a/components/transfer/list.tsx +++ b/components/transfer/list.tsx @@ -7,7 +7,7 @@ import Checkbox from '../checkbox'; import Search from './search'; import defaultRenderList from './renderListBody'; import triggerEvent from '../_util/triggerEvent'; -import { defineComponent } from 'vue'; +import { defineComponent, nextTick } from 'vue'; const defaultRender = () => null; @@ -96,7 +96,7 @@ export default defineComponent({ // } }, updated() { - this.$nextTick(() => { + nextTick(() => { if (this.scrollEvent) { this.scrollEvent.remove(); } diff --git a/components/transfer/renderListBody.tsx b/components/transfer/renderListBody.tsx index df521cbdc..5e2718ff7 100644 --- a/components/transfer/renderListBody.tsx +++ b/components/transfer/renderListBody.tsx @@ -1,4 +1,4 @@ -import { defineComponent } from 'vue'; +import { defineComponent, nextTick } from 'vue'; import raf from '../_util/raf'; import ListItem from './ListItem'; import PropTypes, { withUndefined } from '../_util/vue-types'; @@ -35,7 +35,7 @@ const ListBody = defineComponent({ }, watch: { itemsLength() { - this.$nextTick(() => { + nextTick(() => { const { lazy } = this.$props; if (lazy !== false) { const container = findDOMNode(this); diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 7e33999a6..57bc46683 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject, CSSProperties } from 'vue'; +import { defineComponent, inject, CSSProperties, nextTick } from 'vue'; import BaseMixin from '../_util/BaseMixin'; import { getOptionProps, initDefaultProps } from '../_util/props-util'; import { @@ -41,7 +41,7 @@ export default defineComponent({ }; }, updated() { - this.$nextTick(() => { + nextTick(() => { const { listType, items, previewFile } = this.$props; if (listType !== 'picture' && listType !== 'picture-card') { return; diff --git a/components/vc-select/OptionList.tsx b/components/vc-select/OptionList.tsx index c78d58c05..840b9b2c6 100644 --- a/components/vc-select/OptionList.tsx +++ b/components/vc-select/OptionList.tsx @@ -72,7 +72,7 @@ const OptionListProps = { * Using virtual list of option display. * Will fallback to dom if use customize render. */ -const OptionList = defineComponent({ +const OptionList = defineComponent({ name: 'OptionList', inheritAttrs: false, setup(props) { diff --git a/components/vc-select/Select.tsx b/components/vc-select/Select.tsx index de323e75b..1f08585e7 100644 --- a/components/vc-select/Select.tsx +++ b/components/vc-select/Select.tsx @@ -52,7 +52,7 @@ import omit from 'lodash-es/omit'; const RefSelect = generateSelector({ prefixCls: 'rc-select', components: { - optionList: SelectOptionList, + optionList: SelectOptionList as any, }, convertChildrenToData: convertSelectChildrenToData, flattenOptions, diff --git a/components/vc-select/generate.tsx b/components/vc-select/generate.tsx index 884705041..5499329d5 100644 --- a/components/vc-select/generate.tsx +++ b/components/vc-select/generate.tsx @@ -281,7 +281,7 @@ export interface SelectProps { export interface GenerateConfig { prefixCls: string; components: { - optionList: DefineComponent & { options: OptionsType }>; + optionList: DefineComponent & { options?: OptionsType }>; }; /** Convert jsx tree into `OptionsType` */ convertChildrenToData: (children: VNodeChild | JSX.Element) => OptionsType; @@ -321,7 +321,7 @@ export default function generateSelector< key?: Key; disabled?: boolean; }[] ->(config: GenerateConfig): DefineComponent> { +>(config: GenerateConfig) { const { prefixCls: defaultPrefixCls, components: { optionList: OptionList }, @@ -334,7 +334,7 @@ export default function generateSelector< warningProps, fillOptionsWithMissingValue, omitDOMProps, - } = config; + } = config as any; const Select = defineComponent>({ name: 'Select', setup(props: SelectProps) { diff --git a/tests/setup.js b/tests/setup.js index 5590ecbcc..c2ba6f9d3 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,5 +1,9 @@ -// Vue.config.silent = true +import { config } from '@vue/test-utils'; +config.global.stubs = { + transition: false, + 'transition-group': false, +}; /* eslint-disable global-require */ if (typeof window !== 'undefined') { global.window.resizeTo = (width, height) => {