mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Tabbar): modify test case with route mode
(#9924)
This commit is contained in:
parent
c91be41922
commit
cb6c10cd32
@ -10,7 +10,7 @@ exports[`placeholder prop 1`] = `
|
|||||||
|
|
||||||
exports[`route mode 1`] = `
|
exports[`route mode 1`] = `
|
||||||
<div class="van-hairline--top-bottom van-tabbar van-tabbar--fixed">
|
<div class="van-hairline--top-bottom van-tabbar van-tabbar--fixed">
|
||||||
<div class="van-tabbar-item van-tabbar-item--active">
|
<div class="van-tabbar-item">
|
||||||
<div class="van-tabbar-item__icon">
|
<div class="van-tabbar-item__icon">
|
||||||
<!---->
|
<!---->
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import { mount, later, mockGetBoundingClientRect } from '../../../test';
|
import { later, mockGetBoundingClientRect, mount } from '../../../test';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Tabbar from '..';
|
import Tabbar from '..';
|
||||||
|
import { createLocalVue } from '@vue/test-utils';
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
test('route mode', async () => {
|
test('route mode', async () => {
|
||||||
const router = new VueRouter();
|
const router = new VueRouter({
|
||||||
const wrapper = mount({
|
routes: [
|
||||||
router,
|
{ path: '/', component: { render: () => '/' } },
|
||||||
template: `
|
{ path: '/search', component: { render: () => '/search' } },
|
||||||
|
{ path: '/star', component: { render: () => '/star' } },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const localVue = createLocalVue();
|
||||||
|
localVue.use(VueRouter);
|
||||||
|
|
||||||
|
const wrapper = mount(
|
||||||
|
{
|
||||||
|
template: `
|
||||||
<van-tabbar route>
|
<van-tabbar route>
|
||||||
<van-tabbar-item replace to="/">
|
<van-tabbar-item replace to="/">
|
||||||
Tab
|
Tab
|
||||||
@ -25,7 +35,9 @@ test('route mode', async () => {
|
|||||||
</van-tabbar-item>
|
</van-tabbar-item>
|
||||||
</van-tabbar>
|
</van-tabbar>
|
||||||
`,
|
`,
|
||||||
});
|
},
|
||||||
|
{ localVue, router }
|
||||||
|
);
|
||||||
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user