From 3a2eaa50c1961ddb2604d6e32c343222e5e782ae Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Fri, 7 Jun 2024 15:11:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0web-view=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/compress-video/compress-video.test.js | 2 +- pages/API/compress-video/compress-video.uvue | 2 +- .../web-view-local/web-view-local.test.js | 32 +++++++++++++------ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pages/API/compress-video/compress-video.test.js b/pages/API/compress-video/compress-video.test.js index 2afb2625..a80a04e4 100644 --- a/pages/API/compress-video/compress-video.test.js +++ b/pages/API/compress-video/compress-video.test.js @@ -19,7 +19,7 @@ describe('API-compressVideo', () => { expect(await page.data('videoInfoForTest')).toEqual({ width: 640, height: 360, - // isSizeReduce: true + isSizeReduce: true }); }); }); diff --git a/pages/API/compress-video/compress-video.uvue b/pages/API/compress-video/compress-video.uvue index f4ccd2c8..f71c492a 100644 --- a/pages/API/compress-video/compress-video.uvue +++ b/pages/API/compress-video/compress-video.uvue @@ -132,7 +132,7 @@ this.videoInfoForTest = { "width": __res.width, "height": __res.height, - // "isSizeReduce": afterComoressSize < beforeCompressSize + "isSizeReduce": afterComoressSize < beforeCompressSize }; } }); diff --git a/pages/component/web-view-local/web-view-local.test.js b/pages/component/web-view-local/web-view-local.test.js index 62c2e089..b11d3728 100644 --- a/pages/component/web-view-local/web-view-local.test.js +++ b/pages/component/web-view-local/web-view-local.test.js @@ -42,15 +42,29 @@ describe('component-native-web-view', () => { }); return; } - expect(await page.data('eventDownload')).toEqual({ - tagName: 'WEB-VIEW', - type: 'download', - url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', - userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`, - contentDisposition: `attachment; filename="hello-uniappx.apk"; filename*=utf-8''hello-uniappx.apk`, - mimetype: 'application/vnd.android.package-archive', - contentLength: 27317517 - }); + const infos = process.env.uniTestPlatformInfo.split(' '); + const version = parseInt(infos[infos.length - 1]); + if (version > 8) { + expect(await page.data('eventDownload')).toEqual({ + tagName: 'WEB-VIEW', + type: 'download', + url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', + userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`, + contentDisposition: `attachment; filename="hello-uniappx.apk"; filename*=utf-8''hello-uniappx.apk`, + mimetype: 'application/vnd.android.package-archive', + contentLength: 27317517 + }); + } else { // 低版本webview内核,部分属性无有效值 + expect(await page.data('eventDownload')).toEqual({ + tagName: 'WEB-VIEW', + type: 'download', + url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', + userAgent: '', + contentDisposition: '', + mimetype: '', + contentLength: -1 + }); + } }); it('test event message', async () => { -- GitLab