[new feature] ImagePreview: add index slot (#3157)

This commit is contained in:
neverland
2019-04-15 20:59:00 +08:00
committed by GitHub
parent 8d1c02cfbd
commit ce4e0cc3e9
6 changed files with 92 additions and 18 deletions
@@ -1,5 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`index slot 1`] = `
<div class="van-image-preview" name="van-fade">
<div class="van-image-preview__index">Custom Index</div>
<div class="van-swipe">
<div class="van-swipe__track" style="width: 0px; transition-duration: 0ms; transform: translateX(0px);"></div>
</div>
</div>
`;
exports[`render image 1`] = `
<div class="van-image-preview" name="van-fade">
<div class="van-image-preview__index">1/3</div>
+13 -6
View File
@@ -1,12 +1,7 @@
import Vue from 'vue';
import ImagePreview from '..';
import ImagePreviewVue from '../ImagePreview';
import {
mount,
trigger,
triggerDrag,
transitionStub
} from '../../../test/utils';
import { mount, trigger, triggerDrag, transitionStub } from '../../../test/utils';
transitionStub();
@@ -109,3 +104,15 @@ test('zoom', async () => {
expect(wrapper).toMatchSnapshot();
Element.prototype.getBoundingClientRect = getBoundingClientRect;
});
test('index slot', () => {
const wrapper = mount({
template: `
<van-image-preview :value="true">
<template v-slot:index>Custom Index</template>
</van-image-preview>
`
});
expect(wrapper).toMatchSnapshot();
});