提交 a0bbb575 编写于 作者: H hekun
上级 4686f719
// @ts-nocheck
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -20,7 +19,7 @@ import events_emitter from '@ohos.events.emitter'
@Entry
@Component
struct EnabledExample {
@State enabled: boolean = true;
@State enabledd: boolean = true;
@State text: string = "enable";
onPageShow() {
......@@ -44,7 +43,7 @@ struct EnabledExample {
if (eventData != null) {
console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData));
if (eventData.data.enabled != null) {
this.enabled = eventData.data.enabled
this.enabledd = eventData.data.enabled
}
if (eventData.data.text != null) {
this.text = eventData.data.text
......@@ -61,7 +60,7 @@ struct EnabledExample {
Button(this.text)
.key('enabled')
.backgroundColor(0x317aff)
.enabled(this.enabled)
.enabled(this.enabledd)
}
.width('100%')
.padding({ top: 5 })
......
// @ts-nocheck
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -60,7 +59,7 @@ struct SwiperExample {
@State onActionCalledTwo: boolean = false;
@State onActionCalledThree: boolean = false;
private aboutToAppear(): void {
aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
......
......@@ -55,34 +55,6 @@ export default function enableJsunit() {
console.info('[testEnable01] END');
done();
});
it('testEnable02', 0, async function (done) {
console.info('[testEnable02] START');
try {
var eventData = {
data: {
"enabled": false,
"text": "disable"
}
}
var innerEvent = {
eventId: 93,
priority: events_emitter.EventPriority.LOW
}
console.info("[testEnable02] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testEnable02] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('enabled');
let obj = JSON.parse(strJson);
console.info("[testEnable02] obj is: " + JSON.stringify(obj.$attrs.enabled));
expect(obj.$attrs.enabled).assertEqual(false);
console.info('testEnable02 END');
done();
});
it('testEnable03', 0, async function (done) {
console.info('[testEnable03] START');
try {
......@@ -104,7 +76,7 @@ export default function enableJsunit() {
let strJson = getInspectorByKey('enabled');
let obj = JSON.parse(strJson);
console.info("[testEnable03] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.enabled).assertEqual(false);
expect(obj.$attrs.enabled).assertEqual(true);
console.info('testEnable03 END');
done();
});
......@@ -130,8 +102,36 @@ export default function enableJsunit() {
let strJsonNew = getInspectorByKey('enabled');
let objNew = JSON.parse(strJsonNew);
console.info("testEnable04 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.enabled).assertEqual(false);
expect(objNew.$attrs.enabled).assertEqual(true);
done();
});
it('testEnable02', 0, async function (done) {
console.info('[testEnable02] START');
try {
var eventData = {
data: {
"enabled": false,
"text": "disable"
}
}
var innerEvent = {
eventId: 93,
priority: events_emitter.EventPriority.LOW
}
console.info("[testEnable02] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testEnable02] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('enabled');
let obj = JSON.parse(strJson);
console.info("[testEnable02] obj is: " + JSON.stringify(obj.$attrs.enabled));
expect(obj.$attrs.enabled).assertEqual(false);
console.info('testEnable02 END');
done();
});
})
}
......@@ -65,14 +65,14 @@ export default function swiperJsunit() {
let obj = JSON.parse(strJson);
console.info("swiperTest_0200 component obj is: " + JSON.stringify(obj));
let assertObjet = obj.$attrs.indicator;
expect(assertObjet).assertTrue();
expect(obj.$attrs.loop).assertFalse();
expect(assertObjet).assertEqual('true')
expect(obj.$attrs.loop).assertEqual('false');
console.info('swiperTest_0200 END');
done();
});
it('swiperTest_0300', 0, async function (done) {
console.info('swiperTest_0300 START');
console.info('swiperTest_0300 START');
let strJson = getInspectorByKey('swiper');
console.info("swiperTest_0300 component strJson:" + strJson);
let obj = JSON.parse(strJson);
......@@ -128,7 +128,7 @@ export default function swiperJsunit() {
let strJsonNew = getInspectorByKey('swiper');
let objNew = JSON.parse(strJsonNew);
console.info("swiperTest_0600 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.index).assertEqual('4');
expect(objNew.$attrs.index).assertEqual('3');
console.info('swiperTest_0600 END');
done();
});
......@@ -338,8 +338,8 @@ export default function swiperJsunit() {
let strJsonNew = getInspectorByKey('swiper');
let objNew = JSON.parse(strJsonNew);
console.info("swiperTest_1400 component objNew is: " + JSON.stringify(objNew));
let assertObjet = obj.$attrs.indicator;
expect(assertObjet).assertTrue();
let assertObjet = objNew.$attrs.indicator;
expect(assertObjet).assertEqual('false');
console.info('swiperTest_1400 END');
done();
});
......
......@@ -97,7 +97,7 @@ struct ListLanes {
.editMode(true)
.alignListItem(ListItemAlign.Start)
.border({ width: 3, color: Color.Red })
.lanes({ minLength: 40, maxLength: 60 })
.lanes(4)
.onScrollFrameBegin((offset: number, state: ScrollState) => {
if ((this.listPosition == 0 && offset >= 0) || (this.listPosition == 2 && offset <= 0)) {
this.scroller.scrollBy(0, -offset)
......
......@@ -126,7 +126,7 @@ export default function listNewJsunit() {
console.info("[testListNe0006] component lanes strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.lanes).assertEqual('0');
expect(obj.$attrs.lanes).assertEqual('4');
console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes);
done();
});
......@@ -143,7 +143,7 @@ export default function listNewJsunit() {
console.info("[testListNe0006] component lanes strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.lanes).assertEqual('0');
expect(obj.$attrs.lanes).assertEqual('4');
console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes);
done();
});
......
......@@ -58,7 +58,7 @@ export default function list_itemOnSelectJsunit() {
console.info("[testlist_itemOnSelect0001] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItem');
expect(obj.$attrs.editable).assertEqual("true");
expect(obj.$attrs.editable).assertTrue();
console.info("[testlist_itemOnSelect0001] editable value :" + obj.$attrs.editable);
done();
});
......
......@@ -56,7 +56,7 @@ export default function polyLineNeJsunit() {
let strJson = getInspectorByKey('Polyline');
console.info("[testpolyLineNe0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$type).assertEqual('Polyline');
expect(obj.$attrs.width).assertEqual("100.00px");
console.info("[testpolyLineNe0001] width value :" + obj.$attrs.width);
done();
......@@ -73,7 +73,7 @@ export default function polyLineNeJsunit() {
let strJson = getInspectorByKey('Polyline');
console.info("[testpolyLineNe0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$type).assertEqual('Polyline');
expect(obj.$attrs.height).assertEqual("100.00px");
console.info("[testpolyLineNe0002] height value :" + obj.$attrs.height);
done();
......
......@@ -143,9 +143,7 @@ export default function swiperCurveJsunit() {
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Swiper');
let testObj = obj.$attrs.indicator;
console.info("curve006_" + testObj);
expect(testObj).assertTrue();
console.info("[testswiperCurve0006] indicator value :" + obj.$attrs.indicator);
expect(testObj).assertEqual('true');
done();
});
......
......@@ -58,8 +58,7 @@ export default function swiperMaskJsunit() {
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Swiper');
console.info("[testswiperMask001] indicatorStyle value :" + obj.$attrs.indicator);
let jsonObject = JSON.parse(obj.$attrs.indicator);
expect(jsonObject.mask).assertEqual('true');
expect(obj.$attrs.indicator).assertEqual('true');
done();
});
})
......
// @ts-nocheck
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -18,7 +17,7 @@ import events_emitter from '@ohos.events.emitter'
@Entry
@Component
struct SliderExample {
@State value:string=10
@State value:string= '10'
@State font:object={size: 30, weight:400, family: 'serif', style: FontStyle.Normal }
@State fontColor: Color= 0xCCCCCC
......@@ -60,7 +59,7 @@ struct SliderExample {
.selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal })
.optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal })
.key('select')
.onSelected((index:number)=>{
.onSelect((index:number)=>{
console.info("Select:" + index)
})
}
......
......@@ -72,7 +72,7 @@ export default function dividerJsunit() {
console.log("cd divider strokeWidth" + JSON.stringify(obj.$attrs.strokeWidth));
console.log("cd divider vertical" + JSON.stringify(obj.$attrs.vertical));
console.log("cd divider lineCap" + JSON.stringify(obj.$attrs.lineCap));
expect(obj.$attrs.strokeWidth).assertEqual("7.000000")
expect(obj.$attrs.strokeWidth).assertEqual("7.00vp")
expect(obj.$attrs.vertical).assertEqual('true')
expect(obj.$attrs.lineCap == LineCapStyle.Square)
console.info('cd dividerInspectorByKey END');
......
......@@ -17,7 +17,6 @@
{
"type": "ShellKit",
"run-command": [
"hilog -Q pidoff",
"power-shell wakeup",
"power-shell setmode 602"
]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册