[new feature] Tabs: add nav-left、nav-right slots (#2828)

This commit is contained in:
neverland
2019-02-23 19:19:03 +08:00
committed by GitHub
parent 4bdb1841fa
commit ac76ca0b40
5 changed files with 57 additions and 6 deletions

View File

@@ -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();
});