test(Tab): add dynamic insert case (#6102)

This commit is contained in:
neverland
2020-04-20 19:54:12 +08:00
committed by GitHub
parent 5ebc51e774
commit daa8a8ce95
2 changed files with 50 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { mount, later } from '../../../test';
// this case will throw wierd error in index.spec.js
// so separate it
test('insert tab dynamically', async () => {
const wrapper = mount({
template: `
<van-tabs v-model="active">
<van-tab title="1">1</van-tab>
<div v-if="insert">
<van-tab title="2">2</van-tab>
</div>
<van-tab title="3">3</van-tab>
</van-tabs>
`,
data() {
return {
insert: false,
active: 1,
};
},
});
await later();
wrapper.setData({ insert: true });
expect(wrapper).toMatchSnapshot();
});