From 874ba95b5dc5309d13d017bcfa888aae3d34e4c5 Mon Sep 17 00:00:00 2001 From: wang-xupeng2 Date: Wed, 22 Feb 2023 15:50:58 +0800 Subject: [PATCH] modify rating and search Signed-off-by: wang-xupeng2 --- .../src/main/ets/MainAbility/pages/RatingPage.ets | 2 +- .../entry/src/main/ets/test/RatingJsunit.test.ets | 5 +++-- .../entry/src/main/ets/test/SearchJsunit.test.ets | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/RatingPage.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/RatingPage.ets index ea9c403ee..c70b3c725 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/RatingPage.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/RatingPage.ets @@ -18,7 +18,7 @@ import {MessageManager,Callback} from '../utils/MessageManager'; @Component struct RatingPage { @State rating: number = 3.5 - @State indicator : boolean = false + @State indicator : boolean = true @State stars: number = 5 @State stepSize: number = 0.5 @State text: string = 'no change' diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/RatingJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/RatingJsunit.test.ets index 2a0511159..2c0c2902e 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/RatingJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/RatingJsunit.test.ets @@ -51,7 +51,7 @@ export default function RatingJsunit() { console.info("[RatingJsunit_0100] component obj is: " + JSON.stringify(obj)); await CommonFunc.sleep(1000); expect(obj.$attrs.rating).assertEqual('3.500000'); - expect(obj.$attrs.indicator).assertEqual('false'); + expect(obj.$attrs.indicator).assertEqual('true'); expect(obj.$attrs.stars).assertEqual('5'); expect(obj.$attrs.stepSize).assertEqual('0.500000'); expect(obj.$attrs.starStyle).assertEqual('{"backgroundUri":"resources/base/media/star_1.png","foregroundUri":"resources/base/media/star_2.png","secondaryUri":"resources/base/media/star_3.png"}'); @@ -134,7 +134,8 @@ export default function RatingJsunit() { console.info('[RatingJsunit_0600] START'); await CommonFunc.sleep(1000); // Modify the indicator value of the Rating component - globalThis.value.message.notify({name:'indicator',value:false}) + globalThis.value.message.notify({name:'rating',value:1}) + await CommonFunc.sleep(1000); let driver = await UiDriver.create() let textComponent1 = await driver.findComponent(BY.key('text')); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets index 46ad6a42b..eee2843ca 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets @@ -63,8 +63,8 @@ export default function SearchJsunit() { expect(obj.$attrs.searchButton).assertEqual('SEARCH'); expect(obj.$attrs.placeholderColor).assertEqual('#FF808080'); expect(obj.$attrs.value).assertEqual(''); - expect(obj.$attrs.placeholderFont).assertEqual('{ "style": "FontStyle.Normal", "size": "14.00fp", "weight": "400", "fontFamily ": "sans-serif" }'); - expect(obj.$attrs.textFont).assertEqual('{ "fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); + expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); + expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.InApp'); expect(obj.$attrs.placeholder).assertEqual('Type to search...'); @@ -113,8 +113,8 @@ export default function SearchJsunit() { expect(obj.$attrs.icon).assertEqual('./resources/base/media/star_3.png'); expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH'); expect(obj.$attrs.value).assertEqual('hello'); - expect(obj.$attrs.placeholderFont).assertEqual('{ "style": "FontStyle.Normal", "size": "20.00fp", "weight": "500", "fontFamily ": "sans-serif" }'); - expect(obj.$attrs.textFont).assertEqual('{ "fontSize":"20.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.500","fontFamily":"HarmonyOS Sans"}'); + expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"20.00fp","weight":"500","fontFamily":"sans-serif"}'); + expect(obj.$attrs.textFont).assertEqual('{"fontSize":"20.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.500","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.LocalDevice'); expect(obj.$attrs.placeholderColor).assertEqual('#FF008000'); @@ -156,7 +156,7 @@ export default function SearchJsunit() { await textComponent4.click() let copy = await driver.findComponent(BY.key('copy')); let text3 = await copy.getText(); - expect(text3).assertEqual('onCopy:'); + expect(text3).assertEqual('onCopy:hello'); // Verify the onCut function of the Search component await textComponent1.longClick() @@ -226,8 +226,8 @@ export default function SearchJsunit() { expect(obj.$attrs.searchButton).assertEqual('10'); expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A'); expect(obj.$attrs.value).assertEqual('hello'); - expect(obj.$attrs.placeholderFont).assertEqual('{ "style": "FontStyle.Normal", "size": "14.00fp", "weight": "400", "fontFamily ": "sans-serif" }'); - expect(obj.$attrs.textFont).assertEqual('{ "fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); + expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); + expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.copyOption).assertEqual(''); expect(obj.$attrs.placeholder).assertEqual('Click to search...'); -- GitLab