From 1dc535f674132a454456175ee4aa4991b42a47b2 Mon Sep 17 00:00:00 2001 From: zhangshuqi Date: Sat, 29 Jul 2023 22:41:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0api=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangshuqi --- .../main/ets/MainAbility/pages/navition3.ets | 61 +++++++++++++++++++ .../ets/test/ApiCommponentAddJsunit.test.ets | 34 +++++++++++ .../resources/base/profile/main_pages.json | 3 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navition3.ets diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navition3.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navition3.ets new file mode 100644 index 000000000..e954af4f6 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navition3.ets @@ -0,0 +1,61 @@ +@Entry +@Component +struct navigationType { + @State strokeWidthStr: string = '10px' + @State dividerColorStr: string = '#000000' + @State startMarginStr: string = '5px' + @State endMarginStr: string = '5px' + + @State nullFlag: boolean = false + + @State dividerColor: Color = Color.Red + + + private arr: number[] = [1, 2, 3]; + normalIcon : Resource = $r("app.media.icon") + selectedIcon: Resource = $r("app.media.icon") + + build() { + Column() { + Navigation() { + TextInput({ placeholder: 'search...' }) + .width("90%") + .height(40) + .backgroundColor('#FFFFFF') + + List({ space: 12 }) { + ForEach(this.arr, (item) => { + ListItem() { + NavRouter() { + Text("NavRouter" + item) + .width("100%") + .height(72) + .backgroundColor('#FFFFFF') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + NavDestination() { + Text("NavDestinationContent" + item) + } + .title("NavDestinationTitle" + item) + } + + } + }, item => item) + } + .width("90%") + .margin({ top: 12 }) + }.key("ArkUX_Navigation_1111") + .title("������������") + .titleMode(NavigationTitleMode.Mini) + .mode(NavigationMode.Auto) + .minContentWidth(50) + .navBarWidth(100) + .navBarWidthRange([50, 300]) + } + .height('100%') + .width('100%') + .backgroundColor('#F1F3F5') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets index 20121d97f..4115fb7be 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets @@ -593,6 +593,40 @@ export default function ApiCommponentAddJsunit() { expect(obj.$attrs.margin).assertEqual('0.00vp'); done(); }); + + it('apiCommponentAddJsunit_2300', 0, async function (done) { + console.info("[apiCommponentAddJsunit_2300] START" ); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/navition3', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('ArkUX_Navigation_1111'); + console.info('apiCommponentAddJsunit_2300 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("apiCommponentAddJsunit_2300 obj is: " + JSON.stringify(obj)); + let mode = obj.$attrs.mode + let minContentWidth = obj.$attrs.minContentWidth + let navBarWidth = obj.$attrs.navBarWidth + let navBarWidthRange = obj.$attrs.navBarWidthRange + expect(mode).assertEqual("NavigationMode.AUTO"); + expect(minContentWidth).assertEqual("50.00vp"); + expect(navBarWidth).assertEqual("100.00vp"); + expect(navBarWidthRange).assertEqual("50.00vp, 300.00vp"); + console.info('apiCommponentAddJsunit_2300 END '); + done(); + }); + }) diff --git a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json index 88df3d5c6..eec49f298 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json @@ -89,6 +89,7 @@ "MainAbility/pages/RenderFit", "MainAbility/pages/Xcomponent", "MainAbility/pages/RouteType1", - "MainAbility/pages/RouteType2" + "MainAbility/pages/RouteType2", + "MainAbility/pages/navition3" ] } \ No newline at end of file -- GitLab