mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(DatePicker): fix the value is not updated in time of change event (#11529)
This commit is contained in:
parent
5412837a87
commit
8bd56f0897
@ -54,7 +54,7 @@ test('should watch modelValue prop and render correctly', async () => {
|
|||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should emit change event after dragging options', () => {
|
test('should emit change event after dragging options', async () => {
|
||||||
const wrapper = mount(Area, {
|
const wrapper = mount(Area, {
|
||||||
props: {
|
props: {
|
||||||
areaList,
|
areaList,
|
||||||
@ -67,6 +67,7 @@ test('should emit change event after dragging options', () => {
|
|||||||
triggerDrag(columns[2], 0, -100);
|
triggerDrag(columns[2], 0, -100);
|
||||||
columns[2].find('ul').trigger('transitionend');
|
columns[2].find('ul').trigger('transitionend');
|
||||||
|
|
||||||
|
await later();
|
||||||
const params = wrapper.emitted<PickerChangeEventParams[]>('change')?.[0];
|
const params = wrapper.emitted<PickerChangeEventParams[]>('change')?.[0];
|
||||||
expect(params?.[0].selectedValues).toEqual(['120000', '120100', '120101']);
|
expect(params?.[0].selectedValues).toEqual(['120000', '120100', '120101']);
|
||||||
});
|
});
|
||||||
|
@ -160,7 +160,9 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('change', extend({ columnIndex }, getEventParams()));
|
nextTick(() => {
|
||||||
|
emit('change', extend({ columnIndex }, getEventParams()));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickOption = (currentOption: PickerOption, columnIndex: number) =>
|
const onClickOption = (currentOption: PickerOption, columnIndex: number) =>
|
||||||
|
@ -46,7 +46,7 @@ test('should emit cancel event after clicking the cancel button', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should emit change event after draging the column', () => {
|
test('should emit change event after draging the column', async () => {
|
||||||
const wrapper = mount(Picker, {
|
const wrapper = mount(Picker, {
|
||||||
props: {
|
props: {
|
||||||
columns: simpleColumn,
|
columns: simpleColumn,
|
||||||
@ -54,7 +54,7 @@ test('should emit change event after draging the column', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
triggerDrag(wrapper.find('.van-picker-column'), 0, -100);
|
triggerDrag(wrapper.find('.van-picker-column'), 0, -100);
|
||||||
wrapper.find('.van-picker-column ul').trigger('transitionend');
|
await wrapper.find('.van-picker-column ul').trigger('transitionend');
|
||||||
|
|
||||||
expect(wrapper.emitted('change')).toEqual([
|
expect(wrapper.emitted('change')).toEqual([
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user