diff --git a/src/calendar/__test__/__snapshots__/demo.test.jsx.snap b/src/calendar/__test__/__snapshots__/demo.test.jsx.snap index d35f248bf..64604b523 100644 --- a/src/calendar/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/calendar/__test__/__snapshots__/demo.test.jsx.snap @@ -3,7 +3,7 @@ exports[`Calendar > Calendar baseVue demo works fine 1`] = `
- +
- +
Calendar customButtonVue demo works fine 1`] = ` >
- +
- +
Calendar customRangeVue demo works fine 1`] = ` >
- +
- +
Calendar customTextVue demo works fine 1`] = ` >
- +
- +
Calendar mobileVue demo works fine 1`] = ` >
- +
- +
Calendar mobileVue demo works fine 1`] = `
- +
- +
Calendar mobileVue demo works fine 1`] = `
- +
- +
Calendar mobileVue demo works fine 1`] = `
- +
- +
Calendar mobileVue demo works fine 1`] = `
- +
- +
Calendar mobileVue demo works fine 1`] = `
- +
- +
Calendar mobileVue demo works fine 1`] = ` exports[`Calendar > Calendar multipleVue demo works fine 1`] = `
- +
- +
Calendar multipleVue demo works fine 1`] = ` exports[`Calendar > Calendar rangeVue demo works fine 1`] = `
- +
- +
props > : format 1`] = ` -
- -
- -
-
- - -
-
- 请选择日期 -
- - - -
- -
- 日 -
-
- 一 -
-
- 二 -
-
- 三 -
-
- 四 -
-
- 五 -
-
- 六 -
- -
-
- - -
- 2022 年 1 月 -
-
- -
-
-
-
-
-
- - - -
- - - 1 -
- ¥60 -
- -
- - -
- - - 2 -
- ¥60 -
- -
- - -
- - - 3 -
- ¥60 -
- -
- - -
- - - 4 -
- ¥60 -
- -
- - -
- - - 5 -
- ¥60 -
- -
- - -
- - - 6 -
- ¥60 -
- -
- - -
- - - 7 -
- ¥60 -
- -
- - -
- - - 8 -
- ¥60 -
- -
- - -
- - - 9 -
- ¥60 -
- -
- - -
- - - 10 -
- ¥60 -
- -
- - -
- - - 11 -
- ¥60 -
- -
- - -
- - - 12 -
- ¥60 -
- -
- - -
- - - 13 -
- ¥60 -
- -
- - -
- - - 14 -
- ¥60 -
- -
- - -
- - - 15 -
- ¥60 -
- -
- - -
- - - 16 -
- ¥60 -
- -
- - -
- - - 17 -
- ¥60 -
- -
- - -
- - - 18 -
- ¥60 -
- -
- - -
- - - 19 -
- ¥60 -
- -
- - -
- - - 20 -
- ¥60 -
- -
- - -
- - - 21 -
- ¥60 -
- -
- - -
- - - 22 -
- ¥60 -
- -
- - -
- - - 23 -
- ¥60 -
- -
- - -
- - - 24 -
- ¥60 -
- -
- - -
- - - 25 -
- ¥60 -
- -
- - -
- - - 26 -
- ¥60 -
- -
- - -
- - - 27 -
- ¥60 -
- -
- - -
- - - 28 -
- ¥60 -
- -
- - -
- - - 29 -
- ¥60 -
- -
- - -
- - - 30 -
- ¥60 -
- -
- - -
- - - 31 -
- ¥60 -
- -
- - -
- - -
- -
- -
- -
-`; diff --git a/src/calendar/__test__/index.test.jsx b/src/calendar/__test__/index.test.jsx index 53efcb869..9008d8802 100644 --- a/src/calendar/__test__/index.test.jsx +++ b/src/calendar/__test__/index.test.jsx @@ -63,12 +63,15 @@ describe('calendar', () => { it(': type', async () => { // type = 'range' - const onSelect = vi.fn(); const time = ref(''); const character = '-'; const onConfirm = vi.fn((e) => { time.value = dayFormat(e, character); }); + const onSelect = vi.fn((e) => { + time.value = dayFormat(e, character); + }); + const wrapper = mount( { await $dates[selectLastIndex].trigger('click'); expect(onSelect).toHaveBeenCalledTimes(2); - // confirm - const $button = wrapper.findComponent(Button); - await $button.trigger('click'); - // TODO:区间选择器时,返回的应该是数组,但测试环境下只有单条 Date 对象数据 expect(time.value).toEqual([year, month + 1, selectLastIndex + 1].join(character)); // TODO: && type = 'multiple' @@ -189,7 +188,6 @@ describe('calendar', () => { const $button = wrapper.findComponent(Button); await $button.trigger('click'); expect(onConfirm).toHaveBeenCalledTimes(1); - expect(selectTime).toEqual(time); }); }); }); diff --git a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap index a6598b87b..52e8033e3 100644 --- a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap @@ -51,7 +51,7 @@ exports[`Cascader > Cascader baseVue demo works fine 1`] = `
- +
- +
`; @@ -267,7 +267,7 @@ exports[`Cascader > Cascader checkStrictlyVue demo works fine 1`] = `
- +
- +
`; @@ -477,7 +477,7 @@ exports[`Cascader > Cascader keysVue demo works fine 1`] = ` - + - + `; @@ -692,7 +692,7 @@ exports[`Cascader > Cascader lazyVue demo works fine 1`] = ` - + - + `; @@ -908,7 +908,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -1136,7 +1136,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -1339,7 +1339,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -1567,7 +1567,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -1795,7 +1795,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -2027,7 +2027,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -2226,7 +2226,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = ` - + - + @@ -2439,7 +2439,7 @@ exports[`Cascader > Cascader themeTabVue demo works fine 1`] = ` - + - + `; @@ -2625,7 +2625,7 @@ exports[`Cascader > Cascader withTitleVue demo works fine 1`] = ` - + - + `; @@ -2844,7 +2844,7 @@ exports[`Cascader > Cascader withValueVue demo works fine 1`] = ` - + - + `; diff --git a/src/cascader/__test__/__snapshots__/index.test.jsx.snap b/src/cascader/__test__/__snapshots__/index.test.jsx.snap deleted file mode 100644 index fc5970ee9..000000000 --- a/src/cascader/__test__/__snapshots__/index.test.jsx.snap +++ /dev/null @@ -1,167 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`cascader > events > : pick 1`] = ` - - - - + @@ -3837,7 +3837,7 @@ exports[`ConfigProvider > ConfigProvider otherEnVue demo works fine 1`] = `
- +
- +
ConfigProvider otherEnVue demo works fine 1`] = `
- + - + diff --git a/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap b/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap index 6d26fc759..1c3e07a8e 100644 --- a/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap @@ -32,7 +32,7 @@ exports[`DateTimePicker > DateTimePicker baseVue demo works fine 1`] = ` - + - + `; @@ -597,7 +597,7 @@ exports[`DateTimePicker > DateTimePicker customRangeVue demo works fine 1`] = ` - + - + `; @@ -1064,7 +1064,7 @@ exports[`DateTimePicker > DateTimePicker fullVue demo works fine 1`] = ` - + - + `; @@ -2708,7 +2708,7 @@ exports[`DateTimePicker > DateTimePicker mobileVue demo works fine 1`] = ` - + - +
DateTimePicker mobileVue demo works fine 1`] = `
- + - +
DateTimePicker mobileVue demo works fine 1`] = `
- + - + @@ -4321,7 +4321,7 @@ exports[`DateTimePicker > DateTimePicker mobileVue demo works fine 1`] = ` - + - + @@ -4791,7 +4791,7 @@ exports[`DateTimePicker > DateTimePicker timeVue demo works fine 1`] = ` - + - + `; @@ -5492,7 +5492,7 @@ exports[`DateTimePicker > DateTimePicker yearMonthVue demo works fine 1`] = ` - + - + `; diff --git a/src/dialog/__test__/__snapshots__/demo.test.jsx.snap b/src/dialog/__test__/__snapshots__/demo.test.jsx.snap index 0e46ca6b7..271502ea2 100644 --- a/src/dialog/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/dialog/__test__/__snapshots__/demo.test.jsx.snap @@ -21,7 +21,7 @@ exports[`Dialog > Dialog confirmVue demo works fine 1`] = ` - + - +
@@ -114,7 +114,7 @@ exports[`Dialog > Dialog confirmVue demo works fine 1`] = ` - +
- + `; @@ -209,7 +209,7 @@ exports[`Dialog > Dialog feedbackVue demo works fine 1`] = ` - + - +
@@ -289,7 +289,7 @@ exports[`Dialog > Dialog feedbackVue demo works fine 1`] = ` - +
- +
@@ -365,7 +365,7 @@ exports[`Dialog > Dialog feedbackVue demo works fine 1`] = ` - +
- + `; @@ -454,7 +454,7 @@ exports[`Dialog > Dialog imageDialogVue demo works fine 1`] = ` - + - +
Dialog imageDialogVue demo works fine 1`] = ` - +
- + `; @@ -739,7 +739,7 @@ exports[`Dialog > Dialog inputVue demo works fine 1`] = ` - + - +
Dialog inputVue demo works fine 1`] = ` - +
- + `; @@ -1043,7 +1043,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - + - +
@@ -1123,7 +1123,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- +
@@ -1199,7 +1199,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- + @@ -1300,7 +1300,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - + - +
@@ -1393,7 +1393,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- + @@ -1502,7 +1502,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - + - +
Dialog mobileVue demo works fine 1`] = ` - +
- + @@ -1789,7 +1789,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - + - +
Dialog mobileVue demo works fine 1`] = ` - +
- + @@ -2090,7 +2090,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - + - +
@@ -2183,7 +2183,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- +
@@ -2276,7 +2276,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- +
@@ -2369,7 +2369,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- +
@@ -2479,7 +2479,7 @@ exports[`Dialog > Dialog mobileVue demo works fine 1`] = ` - +
- + @@ -2634,7 +2634,7 @@ exports[`Dialog > Dialog multiStateVue demo works fine 1`] = ` - + - +
@@ -2727,7 +2727,7 @@ exports[`Dialog > Dialog multiStateVue demo works fine 1`] = ` - +
- +
@@ -2820,7 +2820,7 @@ exports[`Dialog > Dialog multiStateVue demo works fine 1`] = ` - +
- +
@@ -2913,7 +2913,7 @@ exports[`Dialog > Dialog multiStateVue demo works fine 1`] = ` - +
- +
@@ -3023,7 +3023,7 @@ exports[`Dialog > Dialog multiStateVue demo works fine 1`] = ` - +
- + `; diff --git a/src/drawer/__test__/__snapshots__/demo.test.jsx.snap b/src/drawer/__test__/__snapshots__/demo.test.jsx.snap index 23eab174f..2b55830c0 100644 --- a/src/drawer/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/drawer/__test__/__snapshots__/demo.test.jsx.snap @@ -5,7 +5,7 @@ exports[`Drawer > Drawer baseVue demo works fine 1`] = ` data-v-app="" > - + - + - + - + `; @@ -323,7 +323,7 @@ exports[`Popup > Popup mobileVue demo works fine 1`] = ` - + - + @@ -438,7 +438,7 @@ exports[`Popup > Popup withTitleVue demo works fine 1`] = ` - + - + `; diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index 078144afc..46a51e19b 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -1,4 +1,4 @@ -import { computed, watch, defineComponent, h, ref, nextTick, Teleport, Transition } from 'vue'; +import { computed, watch, defineComponent, h, Fragment, ref, nextTick, Teleport, Transition, onMounted } from 'vue'; import { CloseIcon } from 'tdesign-icons-vue-next'; import popupProps from './props'; @@ -37,6 +37,11 @@ export default defineComponent({ const wrapperVisible = ref(currentVisible.value); const innerVisible = ref(currentVisible.value); + const mounted = ref(false); + + onMounted(() => { + mounted.value = true; + }); // 因为开启 destroyOnClose,会影响 transition 的动画,因此需要前后设置 visible watch(currentVisible, (v) => { @@ -143,11 +148,19 @@ export default defineComponent({ ); - const renderPopupContent = ( - + const inner = ( + <> {renderOverlayContent} {renderContent} + + ); + + const renderPopupContent = mounted.value ? ( + + {inner} + ) : ( + inner ); return (!props.destroyOnClose || wrapperVisible.value) && renderPopupContent;