Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit 77ff4d3

Browse files
committed
chore: Test cases adjust
1 parent ea510d9 commit 77ff4d3

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

src/Vue3DatePicker/Vue3DatePicker.vue

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,29 @@
195195
emit,
196196
);
197197
198-
const { internalModelValue, inputValue, parseExternalModelValue, emitModelValue, checkBeforeEmit } =
199-
useExternalInternalMapper(
200-
props.format,
201-
props.timePicker,
202-
props.monthPicker,
203-
props.range,
204-
props.partialRange,
205-
props.is24,
206-
props.enableTimePicker,
207-
props.enableSeconds,
208-
formatLocaleRef,
209-
props.multiDates,
210-
props.utc,
211-
props.weekPicker,
212-
props.textInputOptions,
213-
emit,
214-
);
198+
const {
199+
internalModelValue,
200+
inputValue,
201+
parseExternalModelValue,
202+
emitModelValue,
203+
checkBeforeEmit,
204+
formatInputValue,
205+
} = useExternalInternalMapper(
206+
props.format,
207+
props.timePicker,
208+
props.monthPicker,
209+
props.range,
210+
props.partialRange,
211+
props.is24,
212+
props.enableTimePicker,
213+
props.enableSeconds,
214+
formatLocaleRef,
215+
props.multiDates,
216+
props.utc,
217+
props.weekPicker,
218+
props.textInputOptions,
219+
emit,
220+
);
215221
216222
const wrapperClass = computed(
217223
(): DynamicClass => ({
@@ -429,5 +435,6 @@
429435
clearValue,
430436
openMenu,
431437
onScroll,
438+
formatInputValue, // exposed for testing purposes
432439
});
433440
</script>

tests/unit/logic.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ describe('Logic connection', () => {
164164
const calendar = menu.findComponent(Calendar);
165165
calendar.vm.$emit('selectDate', { value: selected, current: true });
166166
await calendar.vm.$nextTick();
167-
dp.vm.selectDate();
168-
await dp.vm.$nextTick();
167+
await dp.vm.formatInputValue();
169168

170169
expect(dp.vm.inputValue).toEqual(format(selected));
171170
dp.unmount();
@@ -199,8 +198,7 @@ describe('Logic connection', () => {
199198
const calendar = menu.findComponent(Calendar);
200199
calendar.vm.$emit('selectDate', { value: selected, current: true });
201200
await calendar.vm.$nextTick();
202-
dp.vm.selectDate();
203-
await dp.vm.$nextTick();
201+
await dp.vm.formatInputValue();
204202

205203
expect(dp.vm.inputValue).toEqual('木');
206204
dp.unmount();

0 commit comments

Comments
 (0)