mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(PickerGroup): confirm event missing params (#11566)
This commit is contained in:
parent
a2ab97f328
commit
4bd7e85b5d
@ -85,6 +85,7 @@ export default defineComponent({
|
|||||||
class={bem('tabs')}
|
class={bem('tabs')}
|
||||||
shrink
|
shrink
|
||||||
animated
|
animated
|
||||||
|
lazyRender={false}
|
||||||
>
|
>
|
||||||
{props.tabs.map((title, index) => (
|
{props.tabs.map((title, index) => (
|
||||||
<Tab title={title} titleClass={bem('tab-title')}>
|
<Tab title={title} titleClass={bem('tab-title')}>
|
||||||
|
@ -6,6 +6,62 @@ import { PickerGroup } from '..';
|
|||||||
test('should emit confirm event after clicking the confirm button', async () => {
|
test('should emit confirm event after clicking the confirm button', async () => {
|
||||||
const value1 = ref(['1']);
|
const value1 = ref(['1']);
|
||||||
const value2 = ref(['2']);
|
const value2 = ref(['2']);
|
||||||
|
const value3 = ref(['3']);
|
||||||
|
|
||||||
|
const wrapper = mount({
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const onConfirm = (params: PickerConfirmEventParams) => {
|
||||||
|
emit('confirm', params);
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<PickerGroup
|
||||||
|
title="Title"
|
||||||
|
tabs={['Tab1', 'Tab2', 'Tab3']}
|
||||||
|
onConfirm={onConfirm}
|
||||||
|
>
|
||||||
|
<Picker
|
||||||
|
v-model={value1.value}
|
||||||
|
columns={[{ text: '1', value: '1' }]}
|
||||||
|
/>
|
||||||
|
<Picker
|
||||||
|
v-model={value2.value}
|
||||||
|
columns={[{ text: '2', value: '2' }]}
|
||||||
|
/>
|
||||||
|
<Picker
|
||||||
|
v-model={value3.value}
|
||||||
|
columns={[{ text: '3', value: '3' }]}
|
||||||
|
/>
|
||||||
|
</PickerGroup>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await wrapper.find('.van-picker__confirm').trigger('click');
|
||||||
|
expect(wrapper.emitted('confirm')![0]).toEqual([
|
||||||
|
[
|
||||||
|
{
|
||||||
|
selectedIndexes: [0],
|
||||||
|
selectedOptions: [{ text: '1', value: '1' }],
|
||||||
|
selectedValues: ['1'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selectedIndexes: [0],
|
||||||
|
selectedOptions: [{ text: '2', value: '2' }],
|
||||||
|
selectedValues: ['2'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selectedIndexes: [0],
|
||||||
|
selectedOptions: [{ text: '3', value: '3' }],
|
||||||
|
selectedValues: ['3'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should switch to next step when click confirm button', async () => {
|
||||||
|
const value1 = ref(['1']);
|
||||||
|
const value2 = ref(['2']);
|
||||||
|
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user