test(ImagePreview): fix snapshot (#8443)

This commit is contained in:
neverland 2021-04-01 10:32:34 +08:00 committed by GitHub
parent 96ae24496e
commit aab3646972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 104 deletions

View File

@ -76,113 +76,83 @@ exports[`should swipe to currect index after calling the swipeTo method 1`] = `
`;
exports[`zoom in and drag image to move 1`] = `
DOMWrapper {
"element": <div
class="van-image van-image-preview__image"
style="transition-duration: .3s;"
<div class="van-image van-image-preview__image"
style="transition-duration: .3s;"
>
<img src="https://img.yzcdn.cn/1.png"
class="van-image__img"
style="object-fit: contain;"
>
<img
class="van-image__img"
src="https://img.yzcdn.cn/1.png"
style="object-fit: contain;"
/>
<div
class="van-image__loading"
>
<div
class="van-loading van-loading--spinner"
>
<span
class="van-loading__spinner van-loading__spinner--spinner"
>
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
</span>
<!---->
</div>
<div class="van-image__loading">
<div class="van-loading van-loading--spinner">
<span class="van-loading__spinner van-loading__spinner--spinner">
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
</span>
</div>
<!---->
</div>,
"style": CSSStyleDeclaration {
"0": "transition-duration",
"_importants": Object {
"transition-duration": undefined,
},
"_length": 1,
"_onChange": [Function],
"_values": Object {
"transition-duration": ".3s",
},
},
}
</div>
</div>
`;
exports[`zoom in and drag image to move 2`] = `
DOMWrapper {
"element": <div
class="van-image van-image-preview__image"
style="transition-duration: .3s;"
<div class="van-image van-image-preview__image"
style="transition-duration: .3s;"
>
<img src="https://img.yzcdn.cn/1.png"
class="van-image__img"
style="object-fit: contain;"
>
<img
class="van-image__img"
src="https://img.yzcdn.cn/1.png"
style="object-fit: contain;"
/>
<div
class="van-image__loading"
>
<div
class="van-loading van-loading--spinner"
>
<span
class="van-loading__spinner van-loading__spinner--spinner"
>
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
<i />
</span>
<!---->
</div>
<div class="van-image__loading">
<div class="van-loading van-loading--spinner">
<span class="van-loading__spinner van-loading__spinner--spinner">
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
<i>
</i>
</span>
</div>
<!---->
</div>,
"style": CSSStyleDeclaration {
"0": "transition-duration",
"_importants": Object {
"transition-duration": undefined,
},
"_length": 1,
"_onChange": [Function],
"_values": Object {
"transition-duration": ".3s",
},
},
}
</div>
</div>
`;

View File

@ -328,12 +328,12 @@ test('zoom in and drag image to move', async () => {
// drag image before load
triggerDrag(image, 300, 300);
expect(wrapper.find('.van-image')).toMatchSnapshot();
expect(wrapper.find('.van-image').html()).toMatchSnapshot();
// drag image after load
image.trigger('load');
triggerDrag(image, 300, 300);
expect(wrapper.find('.van-image')).toMatchSnapshot();
expect(wrapper.find('.van-image').html()).toMatchSnapshot();
restore();
});