fix(Tabs): incorrect change event in some cases (#7461)

This commit is contained in:
neverland
2020-10-31 17:35:33 +08:00
committed by GitHub
parent 836be2c639
commit 0cc11a45e1
4 changed files with 39 additions and 20 deletions
+12 -2
View File
@@ -61,12 +61,17 @@ test('swipe to switch tab', async () => {
const onChange = jest.fn();
const wrapper = mount({
template: `
<van-tabs swipeable @change="onChange">
<van-tabs v-model="active" swipeable @change="onChange">
<van-tab title="title1">Text</van-tab>
<van-tab title="title2">Text</van-tab>
<van-tab title="title3" disabled>Text</van-tab>
</van-tabs>
`,
data() {
return {
active: 0,
};
},
methods: {
onChange,
},
@@ -174,7 +179,7 @@ test('name prop', async () => {
const wrapper = mount({
template: `
<van-tabs @click="onClick" @disabled="onDisabled" @change="onChange">
<van-tabs v-model="active" @click="onClick" @disabled="onDisabled" @change="onChange">
<van-tab title="title1" name="a">Text</van-tab>
<van-tab title="title2" name="b">Text</van-tab>
<van-tab title="title3" name="c" disabled>Text</van-tab>
@@ -185,6 +190,11 @@ test('name prop', async () => {
onChange,
onDisabled,
},
data() {
return {
active: 0,
};
},
});
await later();