未验证 提交 5db41d3c 编写于 作者: O openharmony_ci 提交者: Gitee

!9602 增加api用例

Merge pull request !9602 from zhangshuqi/master
/**
* 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
...@@ -593,6 +593,40 @@ export default function ApiCommponentAddJsunit() { ...@@ -593,6 +593,40 @@ export default function ApiCommponentAddJsunit() {
expect(obj.$attrs.margin).assertEqual('0.00vp'); expect(obj.$attrs.margin).assertEqual('0.00vp');
done(); 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();
});
}) })
......
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
"MainAbility/pages/RenderFit", "MainAbility/pages/RenderFit",
"MainAbility/pages/Xcomponent", "MainAbility/pages/Xcomponent",
"MainAbility/pages/RouteType1", "MainAbility/pages/RouteType1",
"MainAbility/pages/RouteType2" "MainAbility/pages/RouteType2",
"MainAbility/pages/navition3"
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册