diff --git a/pages/component/web-view/web-view.test.js b/pages/component/web-view/web-view.test.js index d6078f6c797e2899562169a0507495279a881d9c..a6e400f7aed785455919fd35a3a47dfe06cb2b30 100644 --- a/pages/component/web-view/web-view.test.js +++ b/pages/component/web-view/web-view.test.js @@ -32,12 +32,49 @@ describe('component-native-web-view', () => { }); await page.waitFor(100); await page.callMethod('reload'); + }); + + it('test touch event', async () => { + await page.setData({ + autoTest: true + }); + const info = await page.callMethod('getWindowInfo'); + await program.tap({ + x: 1, + y: (info.statusBarHeight + 44) * info.pixelRatio + 1 + }); + await page.waitFor(100); + expect(await page.data('eventTouchstart')).toEqual({ + clientX: 1, + clientY: 1 + }); + expect(await page.data('eventTap')).toEqual({ + clientX: 1, + clientY: 1 + }); + await page.setData({ + pointerEvents: 'none' + }); + await page.waitFor(100); + await program.tap({ + x: 10, + y: (info.statusBarHeight + 44) * info.pixelRatio + 10 + }); + await page.waitFor(100); + expect(await page.data('eventTouchstart')).toEqual({ + clientX: 1, + clientY: 1 + }); + expect(await page.data('eventTap')).toEqual({ + clientX: 1, + clientY: 1 + }); + await page.setData({ + pointerEvents: 'auto' + }); }); it('test event loading load', async () => { - await page.setData({ - autoTest: true - }); await page.callMethod('reload'); await page.waitFor(100); expect(await page.data('eventLoading')).toEqual({ diff --git a/pages/component/web-view/web-view.uvue b/pages/component/web-view/web-view.uvue index 1478b13ce97eb89163a1b8d8a485acc5a427d6cb..d46914bd6a05e2dc8d97f989fdc2b5f747829b73 100644 --- a/pages/component/web-view/web-view.uvue +++ b/pages/component/web-view/web-view.uvue @@ -1,8 +1,9 @@