From 1cf994f0dc4d327b32ed2ae07df90426f78cf242 Mon Sep 17 00:00:00 2001 From: shutao Date: Mon, 29 Jul 2024 17:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eget-native-view=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 11 ++- .../get-native-view/get-native-view.test.js | 42 ++++++++ .../API/get-native-view/get-native-view.uvue | 96 +++++++++++++++++++ .../utssdk/app-android/index.uts | 24 ++++- .../uts-get-native-view/utssdk/interface.uts | 20 ++++ 5 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 pages/API/get-native-view/get-native-view.test.js create mode 100644 pages/API/get-native-view/get-native-view.uvue diff --git a/pages.json b/pages.json index 9cd8ca8f..504b6914 100644 --- a/pages.json +++ b/pages.json @@ -1107,6 +1107,15 @@ "navigationBarTitleText": "createSelectorQuery | 创建 SelectorQuery 实例" } }, + // #ifndef APP + { + "path": "pages/API/get-native-view/get-native-view", + "style": { + "navigationBarTitleText": "获取原生view", + "backgroundColor": "#F8F8F8" + } + }, + // #endif { "path": "pages/API/create-canvas-context-async/create-canvas-context-async", "group": "1,16,3", @@ -2730,4 +2739,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/pages/API/get-native-view/get-native-view.test.js b/pages/API/get-native-view/get-native-view.test.js new file mode 100644 index 00000000..05f81a52 --- /dev/null +++ b/pages/API/get-native-view/get-native-view.test.js @@ -0,0 +1,42 @@ +describe('get-native-view', () => { + if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') { + it('object', () => { + expect(1).toBe(1) + }) + return + } + let page + beforeAll(async () => { + page = await program.reLaunch('/pages/API/get-native-view/get-native-view') + await page.waitFor('web-view') + }) + + //检测view标签原生View是否匹配 + it('check_view_native_view', async () => { + page.waitFor(100) + const value = await page.callMethod('checkViewNativeView') + expect(value).toBe(true) + }) + + //检测intpu标签原生View是否匹配 + it('check_input_native_view', async () => { + page.waitFor(100) + const value = await page.callMethod('checkInputNativeView') + expect(value).toBe(true) + }) + + //检测textarea标签原生View是否匹配 + it('check_textarea_native_view', async () => { + page.waitFor(100) + const value = await page.callMethod('checkTextareaNativeView') + expect(value).toBe(true) + }) + + //检测view标签原生View是否匹配 + it('check_web_view_native_view', async () => { + page.waitFor(100) + const value = await page.callMethod('checkWebViewNativeView') + expect(value).toBe(true) + }) + +}) diff --git a/pages/API/get-native-view/get-native-view.uvue b/pages/API/get-native-view/get-native-view.uvue new file mode 100644 index 00000000..47df62da --- /dev/null +++ b/pages/API/get-native-view/get-native-view.uvue @@ -0,0 +1,96 @@ +