[new feature] ImagePreview: add index slot (#3157)
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user