From d7547cab1fecf565251bd445add5fd62aa3be2f3 Mon Sep 17 00:00:00 2001 From: zhangjing Date: Mon, 19 Sep 2022 16:17:50 +0800 Subject: [PATCH] =?UTF-8?q?web=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjing --- .../src/main/ets/MainAbility/pages/web.ets | 32 ++++++++++++++++-- .../entry/src/main/ets/test/Utils.ets | 18 ++++++++++ .../src/main/ets/test/WebJsunit.test.ets | 2 +- .../signature/openharmony_sx.p7b | Bin 3842 -> 3469 bytes 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets index b37c0713e..630f93a12 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets @@ -55,6 +55,7 @@ struct Index { @State cacheError:boolean=false @State mixedSwitch:boolean=false @State mixedAllSwitch:boolean=false + @State overViewFalseHeight:number=0 onPageShow(){ let valueChangeEvent={ eventId:10, @@ -207,6 +208,28 @@ struct Index { this.geoShow=false } }) + .onBlur(()=>{ + console.info("onBlur==>") + this.controller.requestFocus() + }) + TextInput({placeholder:"inputs your words"}) + .key('textInput') + .type(InputType.Normal) + .placeholderColor(Color.Blue) + .placeholderFont({size:20,weight:FontWeight.Normal,family:"sans-serif",style:FontStyle.Normal}) + .enterKeyType(EnterKeyType.Next) + .caretColor(Color.Green) + .height(60) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("cursive") + .fontStyle(FontStyle.Italic) + .fontColor(Color.Red) + .maxLength(20) + .border({width:1,color:0x317AF7,radius:10,style:BorderStyle.Solid}) + .onClick(()=>{ + console.info("TextInput click") + }) Row(){ Button("web click").key('webcomponent').onClick(async ()=>{ console.info("key==>"+this.str) @@ -301,7 +324,8 @@ struct Index { } case "emitGetRequestFocus":{ this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"}) - this.controller.requestFocus() + await Utils.sleep(2000) + sendEventByKey('textInput',10,'') break; } case "emitAccessBackward":{ @@ -489,9 +513,11 @@ struct Index { await Utils.sleep(1000) this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"}) setTimeout(()=>{ + let webPageHeight=this.controller.getPageHeight() this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{ + this.overViewFalseHeight=parseInt(res) console.info("getViewResult==>"+res) - Utils.emitEventTwo(1150,res,168) + Utils.emitEventTwo(webPageHeight,res,168) }}) },3000) break; @@ -503,7 +529,7 @@ struct Index { setTimeout(()=>{ this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{ console.info("getViewResult==>"+res) - Utils.emitEventTwo(2350,res,170) + Utils.emitEventTwo(this.overViewFalseHeight,parseInt(res),170) }}) },3000) break; diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets index 1a90ba6ae..d8e0944a8 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets @@ -132,4 +132,22 @@ export default class Utils { console.info("emit emitKey err: " + JSON.stringify(err)); } } + static registerLargerEvent(testCaseName,eventId,done){ + console.info(`[${testCaseName}] START`); + try{ + let callBack=(backData)=>{ + console.info(`${testCaseName} get result is:`+JSON.stringify(backData)); + expect(backData.data.actualValue).assertLarger(backData.data.expectedValue); + console.info(`[${testCaseName}] END`); + done() + } + let innerEvent = { + eventId:eventId, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(innerEvent,callBack) + }catch(err){ + console.info(`[${testCaseName}] err:`+JSON.stringify(err)); + } + } } diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets index 5c955c488..1e55e2548 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets @@ -389,7 +389,7 @@ export default function webJsunit() { */ it('overviewModeAccessTrue',0,async function(done){ emitKey="emitOnPrompt"; - Utils.registerEventTwo("overviewModeAccessTrue",170,done); + Utils.registerLargerEvent("overviewModeAccessTrue",170,done); sendEventByKey('webcomponent',10,''); }) /* diff --git a/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b b/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b index 7ffcdc78527c5c1aa24520ab7e913c5f47c703f0..bd2ec963919e78b14f7b0a95673312126655f454 100644 GIT binary patch delta 434 zcmZpY>y@rIXyWZ;sVudqI5R&_H!m?aRmn=pNY6meKuHHKoSdHm6gJXPN-QYQP01`S zDauSLEdgmLsVqpHxKCtamfplmHvAwSP<*6yU5Pr1MWCK>+%^TSG*|{7Iniy??-Zsdd{DCcXvL2svy``an9W(iHU1|s`S?5Mcqp7J?jr&OMb7rxO&u{+)|=Pj;`q;1JKG$T0Ou litM_ex64(Fe7tS0&k&TFmYJvZwqsvc=uUR)=X2j>004!kl<5Ef delta 750 zcmeB`ZjwtkXyW_F#;Mij(e|B}k)3Hl6W@EF&}$|}Mnhf$ZZ^(@HV?*BW)>z!gC@3l z2!)Ibn%MeTn%KIlmC90!iZk=`bd&Q_QkAR>b>ISdiMc=lB||*}J%fo84Eakc3qbs$ z)ST4B;#8%H8QK#M+HB@yT)^y-T9KGrkdvyHTbWo;kdv95SOPRrNk=KMAP1F4GTv;tj)ucM!%yKB6!XK=8mzh5vG6{z-LQ2@83 z-W6<1d_a(An5U1cyQ>Qp)y^J{en1NyojiR!Ln7l{{T!WqTwUUUehG2KqCCje*FVfP z-r3RF!!_OwXeu@*`gjJ1xcbG1LV_Y5Vg(k%f+K;MkjvSsIIb-d9%|CN6mtY^!!}rj-NZRI=YUaX1FJg9C Tx=#{XeD`