[new feature] Tabs: add nav-left、nav-right slots (#2828)
This commit is contained in:
@@ -139,6 +139,28 @@ exports[`lazy render 2`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`render nav-left & nav-right slot 1`] = `
|
||||
<div class="van-tabs van-tabs--line">
|
||||
<div class="van-tabs__wrap van-hairline--top-bottom">
|
||||
<div class="van-tabs__nav van-tabs__nav--line" style="border-color: #f44;">Nav Left<div class="van-tabs__line" style="background-color: rgb(255, 68, 68);"></div>
|
||||
<div class="van-tab van-tab--active"><span class="van-ellipsis">title1</span></div>
|
||||
<div class="van-tab"><span class="van-ellipsis"></span></div>
|
||||
<div class="van-tab van-tab--disabled"><span class="van-ellipsis">title3</span></div>Nav Right
|
||||
</div>
|
||||
</div>
|
||||
<div class="van-tabs__content">
|
||||
<div class="van-tab__pane" style="">Text</div>
|
||||
<div class="van-tab__pane" style="display: none;">
|
||||
<!---->
|
||||
<div><span>title2</span></div>
|
||||
</div>
|
||||
<div class="van-tab__pane" style="display: none;">
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`swipe to switch tab 1`] = `
|
||||
<div class="van-tabs van-tabs--line">
|
||||
<div class="van-tabs__wrap van-hairline--top-bottom">
|
||||
|
||||
@@ -2,17 +2,19 @@ import Tab from '..';
|
||||
import Tabs from '../../tabs';
|
||||
import { mount, later, triggerDrag } from '../../../test/utils';
|
||||
|
||||
function createWrapper(options) {
|
||||
function createWrapper(options = {}) {
|
||||
return mount({
|
||||
template: `
|
||||
<tabs @change="onChange"
|
||||
<tabs
|
||||
:color="color"
|
||||
:type="type"
|
||||
:swipeable="swipeable"
|
||||
:sticky="sticky"
|
||||
:swipeable="swipeable"
|
||||
:line-width="lineWidth"
|
||||
:lazy-render="lazyRender"
|
||||
@change="onChange"
|
||||
>
|
||||
${options.extraTemplate || ''}
|
||||
<tab :title="title1">Text</tab>
|
||||
<tab>
|
||||
<span slot="title">title2</span>
|
||||
@@ -112,3 +114,14 @@ test('lazy render', async () => {
|
||||
await later();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('render nav-left & nav-right slot', async () => {
|
||||
const wrapper = createWrapper({
|
||||
extraTemplate: `
|
||||
<template v-slot:nav-left>Nav Left</template>
|
||||
<template v-slot:nav-right>Nav Right</template>
|
||||
`
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user