mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Tab: add test cases
This commit is contained in:
parent
37a5c55ddb
commit
aaaf569759
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<van-tabs :active="active" :duration="duration" @click="handleTabClick" @disabled="handleTabDisabledClick">
|
<van-tabs :active="active" :duration="duration" @click="handleTabClick" @disabled="handleTabDisabledClick">
|
||||||
<van-tab title="选项一">内容一</van-tab>
|
<van-tab :title="firstTabTitle" :disabled="firstTabDisabled">内容一</van-tab>
|
||||||
<van-tab title="选项二">内容二</van-tab>
|
<van-tab title="选项二">内容二</van-tab>
|
||||||
<van-tab title="选项三" disabled>内容三</van-tab>
|
<van-tab title="选项三" disabled>内容三</van-tab>
|
||||||
<van-tab title="选项四">内容四</van-tab>
|
<van-tab title="选项四">内容四</van-tab>
|
||||||
@ -17,6 +17,16 @@ export default {
|
|||||||
'van-tabs': Tabs
|
'van-tabs': Tabs
|
||||||
},
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
firstTabTitle: {
|
||||||
|
type: String,
|
||||||
|
default: '选项一'
|
||||||
|
},
|
||||||
|
firstTabDisabled: {
|
||||||
|
type: Boolean
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
active: 0,
|
active: 0,
|
||||||
|
@ -146,4 +146,15 @@ describe('Tabs', () => {
|
|||||||
done();
|
done();
|
||||||
}, 1200);
|
}, 1200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('watch tab props changes', (done) => {
|
||||||
|
wrapper = mount(TabsTestComponent);
|
||||||
|
wrapper.vm.firstTabTitle = '测试标题';
|
||||||
|
wrapper.vm.firstTabDisabled = true;
|
||||||
|
|
||||||
|
wrapper.vm.$nextTick(() => {
|
||||||
|
expect(wrapper.find('.van-tab')[0].text().replace(/\n|\s/g, '')).to.equal('测试标题');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user