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 0000000000000000000000000000000000000000..631245da4aa940373158120760d1b5a7fa86c2cb --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navition3.ets @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@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 20121d97fa74d5a4ba26830e9f3f997c9b7717e0..4115fb7beff846d1fec3cf83fea226b3689d7878 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 88df3d5c63e00409e319fac337c86ea7aca7fc80..eec49f298bfe0053442695c015806d45da3614a2 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