diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets index 3d230c7467b182c9a7028ec7f5a6fc832b0b4338..644999471fc196f2a7bf473f2c2249f5e2ab77cb 100644 --- a/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets @@ -71,32 +71,6 @@ struct Index { } build(){ Column(){ - Web({src:$rawfile('index.html'),controller:this.controller}) - .databaseAccess(true) - .zoomAccess(this.zoomAccessValue) - .textZoomRatio(this.textRatio) - .onConsole((event) => { - let level = event.message.getMessageLevel() - let msg = event.message.getMessage() - let lineNumber = event.message.getLineNumber().toString() - let sourceId = event.message.getSourceId() - console.log("lineNumber:" + lineNumber) - setTimeout(()=>{ - Utils.emitEvent(lineNumber,420) - },3000) - setTimeout(()=>{ - Utils.emitEvent(sourceId,422) - },3000) - return false - }) - .onSearchResultReceive(ret=>{ - var searchResult = ret.activeMatchOrdinal.toString() + - ret.numberOfMatches.toString() - console.log("searchResult" + searchResult) - setTimeout(()=>{ - Utils.emitEvent(searchResult,426) - },3000) - }) Row(){ Button("web click").key('webcomponent').onClick(async ()=>{ console.info("key==>"+this.str) @@ -159,7 +133,7 @@ struct Index { } case "emitSaveCookieAsync":{ web_webview.WebCookieManager.saveCookieAsync(function(result){ - Utils.emitEvent(result,410) + Utils.emitEvent("result",410) }) break; } @@ -228,7 +202,7 @@ struct Index { setTimeout(()=>{ let result = this.username_password[0]; Utils.emitEvent(result,444) - },3000) + },5000) break; } case "emitDeleteHttpAuthCredentials":{ @@ -251,6 +225,32 @@ struct Index { } }) } + Web({src:$rawfile('index.html'),controller:this.controller}) + .databaseAccess(true) + .zoomAccess(this.zoomAccessValue) + .textZoomRatio(this.textRatio) + .onConsole((event) => { + let level = event.message.getMessageLevel() + let msg = event.message.getMessage() + let lineNumber = event.message.getLineNumber().toString() + let sourceId = event.message.getSourceId() + console.log("lineNumber:" + lineNumber) + setTimeout(()=>{ + Utils.emitEvent(lineNumber,420) + },3000) + setTimeout(()=>{ + Utils.emitEvent(sourceId,422) + },3000) + return false + }) + .onSearchResultReceive(ret=>{ + var searchResult = ret.activeMatchOrdinal.toString() + + ret.numberOfMatches.toString() + console.log("searchResult" + searchResult) + setTimeout(()=>{ + Utils.emitEvent(searchResult,426) + },3000) + }) } } } diff --git a/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets index deea6fda97ae0eaa363fc455cde30e788b6100f9..edc4a8d8c3af92e7fb8c1336fc30c9a6ba1d785b 100644 --- a/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets +++ b/arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets @@ -101,7 +101,7 @@ export default function webJsunit() { */ it('saveCookieAsync',0,async function(done){ emitKey="emitIsThirdPartyCookieAllowed"; - Utils.registerEvent("saveCookieAsync",true,410,done); + Utils.registerEvent("saveCookieAsync","result",410,done); sendEventByKey('webcomponent',10,''); }) /*