From d81aa30fd4949bf73d481615436c106a4f905d74 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Wed, 13 Nov 2024 15:31:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=20checkGetAndroi?= =?UTF-8?q?dView=20=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/get-current-pages/get-current-pages.test.js | 4 +++- pages/API/get-current-pages/get-current-pages.uvue | 7 +------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pages/API/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js index f4b78e34..962be6d8 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -1,5 +1,7 @@ const HOME_PAGE_PATH = '/pages/tabBar/component' const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages?test=123' +const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() +const isAndroid = platformInfo.startsWith('android') describe('getCurrentPages', () => { let page @@ -92,6 +94,6 @@ describe('getCurrentPages', () => { }) it('getAndroidView', async () => { const res = await page.callMethod('checkGetAndroidView') - expect(res).toBe(true) + expect(res).toBe(isAndroid) }) }) diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue index 3e0e3d08..a81d30e1 100644 --- a/pages/API/get-current-pages/get-current-pages.uvue +++ b/pages/API/get-current-pages/get-current-pages.uvue @@ -208,12 +208,7 @@ checkGetAndroidView() : boolean { const page = this.getCurrentPage() const androidView = page.getAndroidView() - // #ifdef APP-ANDROID const res = androidView != null - // #endif - // #ifndef APP-ANDROID - const res = androidView == null - // #endif console.log('check getAndroidView', res) uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' }) return res @@ -262,4 +257,4 @@ .radio-value { margin-left: 10px; } - + -- GitLab