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 5e749c422b1efe1f94497435c5ac0b4bc055f13b..c7ac703d71ae6d8722e0e0f1165cb4d5905e2862 100644
--- a/pages/API/get-current-pages/get-current-pages.test.js
+++ b/pages/API/get-current-pages/get-current-pages.test.js
@@ -2,6 +2,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')
+const isWeb = platformInfo.startsWith('web')
describe('getCurrentPages', () => {
let page
@@ -100,4 +101,12 @@ describe('getCurrentPages', () => {
const res = await page.callMethod('checkGetAndroidView')
expect(res).toBe(isAndroid)
})
+ it('getIOSView', async () => {
+ const res = await page.callMethod('checkGetIOSView')
+ expect(res).toBe(false)
+ })
+ it('getHTMLElement', async () => {
+ const res = await page.callMethod('checkGetHTMLElement')
+ expect(res).toBe(isWeb)
+ })
})
diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue
index da350afc0a5aee4ed245b298f3c9a78fbc8117f2..62a3b3eef1b51eb1fc145a590ba2883929498b25 100644
--- a/pages/API/get-current-pages/get-current-pages.uvue
+++ b/pages/API/get-current-pages/get-current-pages.uvue
@@ -25,7 +25,13 @@
-
+
+
+
@@ -55,7 +61,7 @@
+
@@ -214,6 +220,22 @@
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
+ checkGetIOSView() : boolean {
+ const page = this.getCurrentPage()
+ const IOSView = page.getIOSView()
+ const res = IOSView != null
+ console.log('check getIOSView', res)
+ uni.showToast(res ? { title: 'check success' } : { title: '仅 IOS uts 插件环境支持', icon: 'error' })
+ return res
+ },
+ checkGetHTMLElement() : boolean {
+ const page = this.getCurrentPage()
+ const HTMLView = page.getHTMLElement()
+ const res = HTMLView != null
+ console.log('check getHTMLElement', res)
+ uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
+ return res
+ },
},
}