diff --git a/pages.json b/pages.json index 9cd8ca8f7b8bc7e4197c08757debcce94e08e222..504b6914286a321e5994f915e18e614f8739ee31 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 0000000000000000000000000000000000000000..05f81a52b3066e0341954b0816af4d296630901d --- /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 0000000000000000000000000000000000000000..47df62daa134e2c549410ab08a970e71e342b1e7 --- /dev/null +++ b/pages/API/get-native-view/get-native-view.uvue @@ -0,0 +1,96 @@ +