fix(ImagePreview): incorrect move range in some cases (#7142)

* fix(ImagePreview): incorrect move range in some cases

* chore: remove inBrowser

* test(ImagePreview): fix failed case
This commit is contained in:
neverland
2020-09-09 17:59:59 +08:00
committed by GitHub
parent 5e6734f31c
commit 3dddeaa7a3
3 changed files with 22 additions and 31 deletions
+1 -8
View File
@@ -219,12 +219,7 @@ test('register component', () => {
});
test('zoom in and drag image to move', async () => {
const restore = mockGetBoundingClientRect({ width: 100 });
const originWindowWidth = window.innerWidth;
const originWindowHeight = window.innerHeight;
window.innerWidth = 100;
window.innerHeight = 100;
const restore = mockGetBoundingClientRect({ width: 100, height: 100 });
const wrapper = mount(ImagePreviewVue, {
propsData: { images, value: true },
@@ -248,8 +243,6 @@ test('zoom in and drag image to move', async () => {
triggerDrag(image, 300, 300);
expect(wrapper.find('.van-image')).toMatchSnapshot();
window.innerWidth = originWindowWidth;
window.innerHeight = originWindowHeight;
restore();
});