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

!3374 【OpenHarmony开源贡献者计划2022】webview

Merge pull request !3374 from bayanxing/master
# Copyright (c) 2021 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AceEtsWebViewTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_ets_webView_assets",
":ace_ets_webView_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AceEtsWebViewTest"
}
ohos_js_assets("ace_ets_webView_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("ace_ets_webView_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.open.harmony.webview",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"AceEtsWebViewTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.open.harmony.webview",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"package": "com.open.harmony.webview",
"name": ".MyApplication",
"mainAbility": "com.open.harmony.webview.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/webStyle",
"pages/webProp",
"pages/webEvent"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE WEBVIEW ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Index {
@State javaScriptAccess: boolean = true;
@State fileAccess: boolean = true;
build() {
Column() {
Row(){
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnAlert")
.onAlert((event?: {
url: string,
message: string,
result: JsResult
}) => {
console.log("onAlert: url -- " + event.url)
console.log("onAlert: message -- " + event.message)
event.result.handleCancel(()=>{
console.log("onAlert: handleCancel -- ")
})
event.result.handleConfirm()(()=>{
console.log("onAlert: handleConfirm -- ")
})
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnBeforeUnload")
.onBeforeUnload((event?: {
url: string,
message: string,
result: JsResult
}) => {
console.log("onBeforeUnload: url -- " + event.url)
console.log("onBeforeUnload: message -- " + event.message)
event.result.handleCancel(()=>{
console.log("onBeforeUnload: handleCancel -- ")
})
event.result.handleConfirm()(()=>{
console.log("onBeforeUnload: handleConfirm -- ")
})
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnConfirm")
.onConfirm((event?: {
url: string,
message: string,
result: JsResult
}) => {
console.log("onConfirm: url -- " + event.url)
console.log("onConfirm: message -- " + event.message)
event.result.handleCancel(()=>{
console.log("onConfirm: handleCancel -- ")
})
event.result.handleConfirm()(()=>{
console.log("onConfirm: handleConfirm -- ")
})
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnConfirm")
.onConsole((event?: {
message: ConsoleMessage
}) => {
console.log("onConsole: getLineNumber -- " + event.message.getLineNumber())
console.log("onConsole: getSourceId -- " + event.message.getSourceId())
console.log("onConsole: getMessageLevel -- " + event.message.getMessageLevel())
console.log("onConsole: getMessage -- " + event.message.getMessage())
})
}
.width("100%")
.height("20%")
Divider().height("5%")
Row(){
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnDownloadStart")
.onDownloadStart((event?: {
url:string,
userAgent:string,
contentDisposition:string,
mimetype: string,
contentLength: number
}) => {
console.log("onDownloadStart: url -- " + event.url)
console.log("onDownloadStart: userAgent -- " + event.userAgent)
console.log("onDownloadStart: contentDisposition -- " + event.contentDisposition)
console.log("onDownloadStart: mimetype -- " + event.mimetype)
console.log("onDownloadStart: contentLength -- " + event.contentLength)
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnErrorReceive")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnHttpErrorReceive")
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnPageBegin")
.onPageBegin((event?: {
url: string
}) => {
console.log("onPageBegin: url -- " + event.url)
})
}
.width("100%")
.height("20%")
Divider().height("5%")
Row(){
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnPageEnd")
.onPageEnd((event?: {
url: string
}) => {
console.log("onPageEnd: url -- " + event.url)
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.key("webViewOnProgressChange")
.onProgressChange((event?: {
newProgress: number
}) => {
console.log("onProgressChange: newProgress -- " + event.newProgress)
})
Divider().width("3%")
Web({ src:'www.baidu.com', controller:null })
.width('20%')
.height('100%')
.zoomAccess(true)
.key("webViewOnTitleReceive")
.onTitleReceive((event?: {
title: string
}) => {
console.log("onTitleReceive: title -- " + event.title)
})
}
.width("100%")
.height("20%")
}.width('100%')
.height('100%').backgroundColor("#ff0000")
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Index {
@State javaScriptAccess: boolean = true;
@State fileAccess: boolean = true;
build() {
Column() {
Row(){
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.domStorageAccess(true)
.key("webViewDomStorageAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.domStorageAccess(false)
.key("webViewDomStorageAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.fileAccess(true)
.key("webViewFileAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.fileAccess(false)
.key("webViewFileAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("20%")
Divider().height("5%")
Row(){
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.imageAccess(true)
.key("webViewImageAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.imageAccess(false)
.key("webViewImageAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.javaScriptAccess(true)
.key("webViewJavaScriptAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.javaScriptAccess(false)
.key("webViewJavaScriptAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("20%")
Divider().height("5%")
Row(){
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.onlineImageAccess(true)
.key("webViewOnlineImageAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.onlineImageAccess(false)
.key("webViewOnlineImageAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.zoomAccess(true)
.key("webViewZoomAccessTrue")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.zoomAccess(false)
.key("webViewZoomAccessFalse")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("20%")
Divider().height("5%")
Row(){
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.mixedMode(MixedMode.None)
.key("webViewMixedModeNone")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.mixedMode(MixedMode.All)
.key("webViewMixedModeAll")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src:$rawfile('test.html'), controller:null })
.width('20%')
.height('100%')
.mixedMode(MixedMode.Compatible)
.key("webViewMixedModeCompatible")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
}
.width("100%")
.height("20%")
}.width('100%')
.height('100%').backgroundColor("#ff0000")
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Index {
@State javaScriptAccess: boolean = true;
@State fileAccess: boolean = true;
build() {
Column() {
Row(){
Web({ src: $rawfile('index.html'), controller:null })
.width('30%')
.height('100%')
.fileAccess(this.fileAccess)
.key("webViewWidthPer")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width(100)
.height('100%')
.fileAccess(this.fileAccess)
.key("webViewWidthPx")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('20%')
.height('80%')
.fileAccess(this.fileAccess)
.key("webViewHeightPer")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width("20%")
.height(50)
.fileAccess(this.fileAccess)
.key("webViewHeightPx")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("30%")
Divider().height("5%")
Row(){
Web({ src: $rawfile('index.html'), controller:null })
.width('20%')
.height('100%')
.padding(10)
.fileAccess(this.fileAccess)
.key("webViewPaddingAll")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('20%')
.height('100%')
.padding({left:10,right:5,top:5,bottom:5})
.fileAccess(this.fileAccess)
.key("webViewPadding")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('20%')
.height('100%')
.margin(10)
.fileAccess(this.fileAccess)
.key("webViewMarginAll")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('20%')
.height('100%')
.margin({left:10,right:5,top:5,bottom:5})
.fileAccess(this.fileAccess)
.key("webViewMargin")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("30%")
Divider().height("5%")
Row(){
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.border({width:2,color:0x317AF7,radius:5,style:BorderStyle.Dashed})
.fileAccess(this.fileAccess)
.key("webViewBorderAll")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderWidth(3)
.fileAccess(this.fileAccess)
.key("webViewBorderWidth")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderColor(0x317AF7)
.fileAccess(this.fileAccess)
.key("webViewBorderColor")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderRadius(6)
.fileAccess(this.fileAccess)
.key("webViewBorderRadius")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderStyle(BorderStyle.Dashed)
.fileAccess(this.fileAccess)
.key("webViewBorderStyleDashed")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderStyle(BorderStyle.Solid)
.fileAccess(this.fileAccess)
.key("webViewBorderStyleSolid")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
Divider().width("3%")
Web({ src: $rawfile('index.html'), controller:null })
.width('14%')
.height('100%')
.borderStyle(BorderStyle.Dotted)
.fileAccess(this.fileAccess)
.key("webViewBorderStyleDotted")
.onErrorReceive((event?: {
request: WebResourceRequest,
error: WebResourceError
}) => {
console.log("onErrorReceive: errCode -- " + event.error.getErrorCode() +";errInfo -- " + event.error.getErrorInfo())
})
.onHttpErrorReceive((event?: {
request: WebResourceRequest,
response: WebResourceResponse
}) => {
console.log("onHttpErrorReceive: message -- " + event.response.getReasonMessage()
+";code -- " + event.response.getResponseCode()
+";data -- " + event.response.getResponseData()
+";enCoding -- " + event.response.getResponseEncoding()
+";header -- " + JSON.stringify(event.response.getResponseHeader())
+";mimeType -- " +event.response.getResponseMimeType())
})
}
.width("100%")
.height("30%")
}.width('100%')
.height('100%').backgroundColor("#ff0000")
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
import webViewPropJsunit from './WebViewPropJsunit.test.ets';
import webViewStyleJsunit from './WebViewStyleJsunit.test.ets';
export default function testsuite() {
//webViewPropJsunit();
//webViewStyleJsunit();
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function webViewPropJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('webViewStyleTest', function () {
beforeEach(async function (done) {
console.info("webViewStyleTest beforeEach start");
let options = {
uri: 'pages/webProp',
}
try {
router.clear();
let pages = router.getState();
console.info("get webView state success " + JSON.stringify(pages));
if (!("webView" == pages.name)) {
console.info("get webView state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push webView page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webView page error " + JSON.stringify(result));
}
await sleep(4)
done()
});
afterEach(async function () {
await sleep(1)
console.info("webView after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewDomStorageAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewDomStorageAccessTrue', 0, async function (done) {
console.info("testWebViewDomStorageAccessTrue START");
let strJson = getInspectorByKey('webViewDomStorageAccessTrue');
console.log("testWebViewDomStorageAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewDomStorageAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewDomStorageAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewDomStorageAccessTrue type" + JSON.stringify(obj.$type))
console.info("testWebViewDomStorageAccessTrue type: " + JSON.stringify(obj.$type));
expect(style.domStorageAccess).assertEqual('true');
console.info("testWebViewDomStorageAccessTrue domStorageAccess is: " + JSON.stringify(style.domStorageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewDomStorageAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewDomStorageAccessFalse', 0, async function (done) {
console.info("testWebViewDomStorageAccessFalse START");
let strJson = getInspectorByKey('webViewDomStorageAccessFalse');
console.log("testWebViewDomStorageAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewDomStorageAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewDomStorageAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewDomStorageAccessFalse type" + JSON.stringify(obj.$type))
console.info("testWebViewDomStorageAccessFalse type: " + JSON.stringify(obj.$type));
expect(style.domStorageAccess).assertEqual('false');
console.info("testWebViewDomStorageAccessFalse domStorageAccess is: " + JSON.stringify(style.domStorageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewFileAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewFileAccessTrue', 0, async function (done) {
console.info("testWebViewFileAccessTrue START");
let strJson = getInspectorByKey('webViewFileAccessTrue');
console.log("testWebViewFileAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewFileAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewFileAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewFileAccessTrue type" + JSON.stringify(obj.$type))
console.info("testWebViewFileAccessTrue type: " + JSON.stringify(obj.$type));
expect(style.fileAccess).assertEqual('true');
console.info("testWebViewFileAccessTrue fileAccess is: " + JSON.stringify(style.fileAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewFileAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewFileAccessFalse', 0, async function (done) {
console.info("testWebViewFileAccessFalse START");
let strJson = getInspectorByKey('webViewFileAccessFalse');
console.log("testWebViewFileAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewFileAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewFileAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewFileAccessFalse type" + JSON.stringify(obj.$type))
console.info("testWebViewFileAccessFalse type: " + JSON.stringify(obj.$type));
expect(style.fileAccess).assertEqual("false");
console.info("testWebViewFileAccessFalse fileAccess is: " + JSON.stringify(style.fileAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewImageAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewImageAccessTrue', 0, async function (done) {
console.info("testWebViewImageAccessTrue START");
let strJson = getInspectorByKey('webViewImageAccessTrue');
console.log("testWebViewImageAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewImageAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewImageAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewImageAccessTrue type" + JSON.stringify(obj.$type))
expect(style.imageAccess).assertEqual("true");
console.info("testWebViewImageAccessTrue imageAccess is: " + JSON.stringify(style.imageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewImageAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewImageAccessFalse', 0, async function (done) {
console.info("testWebViewImageAccessFalse START");
let strJson = getInspectorByKey('webViewImageAccessFalse');
console.log("testWebViewImageAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewImageAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewImageAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewImageAccessFalse type" + JSON.stringify(obj.$type))
expect(style.imageAccess).assertEqual("false");
console.info("testWebViewImageAccessFalse imageAccess is: " + JSON.stringify(style.imageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewJavaScriptAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewJavaScriptAccessTrue', 0, async function (done) {
console.info("testWebViewJavaScriptAccessTrue START");
let strJson = getInspectorByKey('webViewJavaScriptAccessTrue');
console.log("testWebViewJavaScriptAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewJavaScriptAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewJavaScriptAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewJavaScriptAccessTrue type" + JSON.stringify(obj.$type))
expect(style.javaScriptAccess).assertEqual("true");
console.info("testWebViewJavaScriptAccessTrue javaScriptAccess is: " + JSON.stringify(style.javaScriptAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewJavaScriptAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewJavaScriptAccessFalse', 0, async function (done) {
console.info("testWebViewJavaScriptAccessFalse START");
let strJson = getInspectorByKey('webViewJavaScriptAccessFalse');
console.log("testWebViewJavaScriptAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewJavaScriptAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewJavaScriptAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewJavaScriptAccessFalse type" + JSON.stringify(obj.$type))
expect(style.javaScriptAccess).assertEqual("false");
console.info("testWebViewJavaScriptAccessFalse javaScriptAccess is: " + JSON.stringify(style.javaScriptAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewOnlineImageAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewOnlineImageAccessTrue', 0, async function (done) {
console.info("testWebViewOnlineImageAccessTrue START");
let strJson = getInspectorByKey('webViewOnlineImageAccessTrue');
console.log("testWebViewOnlineImageAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewOnlineImageAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewOnlineImageAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewOnlineImageAccessTrue type" + JSON.stringify(obj.$type))
expect(style.onlineImageAccess).assertEqual("true");
console.info("testWebViewOnlineImageAccessTrue onlineImageAccess is: " + JSON.stringify(style.onlineImageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewOnlineImageAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewOnlineImageAccessFalse', 0, async function (done) {
console.info("testWebViewOnlineImageAccessFalse START");
let strJson = getInspectorByKey('webViewOnlineImageAccessFalse');
console.log("testWebViewOnlineImageAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewOnlineImageAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewOnlineImageAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewOnlineImageAccessFalse type" + JSON.stringify(obj.$type))
expect(style.onlineImageAccess).assertEqual("false");
console.info("testWebViewOnlineImageAccessFalse onlineImageAccess is: " + JSON.stringify(style.onlineImageAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewZoomAccessTrue
* @tc.desc aceEtsTest
*/
it('testWebViewZoomAccessTrue', 0, async function (done) {
console.info("testWebViewZoomAccessTrue START");
let strJson = getInspectorByKey('webViewZoomAccessTrue');
console.log("testWebViewZoomAccessTrue strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewZoomAccessTrue obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewZoomAccessTrue style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewZoomAccessTrue type" + JSON.stringify(obj.$type))
expect(style.zoomAccess).assertEqual("true");
console.info("testWebViewZoomAccessTrue zoomAccess is: " + JSON.stringify(style.zoomAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewZoomAccessFalse
* @tc.desc aceEtsTest
*/
it('testWebViewZoomAccessFalse', 0, async function (done) {
console.info("testWebViewZoomAccessFalse START");
let strJson = getInspectorByKey('webViewZoomAccessFalse');
console.log("testWebViewZoomAccessFalse strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewZoomAccessFalse obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewZoomAccessFalse style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewZoomAccessFalse type" + JSON.stringify(obj.$type))
expect(style.zoomAccess).assertEqual("false");
console.info("testWebViewZoomAccessFalse zoomAccess is: " + JSON.stringify(style.zoomAccess));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewMixedModeNone
* @tc.desc aceEtsTest
*/
it('testWebViewMixedModeNone', 0, async function (done) {
console.info("testWebViewMixedModeNone START");
let strJson = getInspectorByKey('webViewMixedModeNone');
console.log("testWebViewMixedModeNone strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewMixedModeNone obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewMixedModeNone style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewMixedModeNone type" + JSON.stringify(obj.$type))
expect(style.mixedMode).assertEqual(MixedMode.None);
console.info("testWebViewMixedModeNone mixedMode is: " + JSON.stringify(style.mixedMode));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewMixedModeAll
* @tc.desc aceEtsTest
*/
it('testWebViewMixedModeAll', 0, async function (done) {
console.info("testWebViewMixedModeAll START");
let strJson = getInspectorByKey('webViewMixedModeAll');
console.log("testWebViewMixedModeAll strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewMixedModeAll obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewMixedModeAll style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewMixedModeAll type" + JSON.stringify(obj.$type))
expect(style.mixedMode).assertEqual(MixedMode.All);
console.info("testWebViewMixedModeAll mixedMode is: " + JSON.stringify(style.mixedMode));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewMixedModeCompatible
* @tc.desc aceEtsTest
*/
it('testWebViewMixedModeCompatible', 0, async function (done) {
console.info("testWebViewMixedModeCompatible START");
let strJson = getInspectorByKey('webViewMixedModeCompatible');
console.log("testWebViewMixedModeCompatible strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewMixedModeCompatible obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewMixedModeCompatible style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewMixedModeCompatible type" + JSON.stringify(obj.$type))
expect(style.mixedMode).assertEqual(MixedMode.Dotted);
console.info("testWebViewMixedModeCompatible mixedMode is: " + JSON.stringify(style.mixedMode));
done();
});
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function webViewStyleJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('webViewStyleTest', function () {
beforeEach(async function (done) {
console.info("webViewStyleTest beforeEach start");
let options = {
uri: 'pages/webStyle',
}
try {
router.clear();
let pages = router.getState();
console.info("get webView state success " + JSON.stringify(pages));
if (!("webView" == pages.name)) {
console.info("get webView state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push webView page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webView page error " + JSON.stringify(result));
}
await sleep(4)
done()
});
afterEach(async function () {
await sleep(1)
console.info("webView after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewWidthPer
* @tc.desc aceEtsTest
*/
it('testWebViewWidthPer', 0, async function (done) {
console.info("testWebViewWidthPer START");
let strJson = getInspectorByKey('webViewWidthPer');
console.log("testWebViewWidthPer strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewWidthPer obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewWidthPer style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewWidthPer type" + JSON.stringify(obj.$type))
console.info("testWebViewWidthPer type: " + JSON.stringify(obj.$type));
expect(style.width).assertEqual('30%');
console.info("testWebViewWidthPer width is: " + JSON.stringify(style.width));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewWidthPx
* @tc.desc aceEtsTest
*/
it('testWebViewWidthPx', 0, async function (done) {
console.info("testWebViewWidthPx START");
let strJson = getInspectorByKey('webViewWidthPx');
console.log("testWebViewWidthPx strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewWidthPx obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewWidthPx style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewWidthPx type" + JSON.stringify(obj.$type))
console.info("testWebViewWidthPx type: " + JSON.stringify(obj.$type));
expect(style.width).assertEqual("100");
console.info("testWebViewWidthPx width is: " + JSON.stringify(style.width));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewHeightPer
* @tc.desc aceEtsTest
*/
it('testWebViewHeightPer', 0, async function (done) {
console.info("testWebViewHeightPer START");
let strJson = getInspectorByKey('webViewHeightPer');
console.log("testWebViewHeightPer strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewHeightPer obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewHeightPer style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewHeightPer type" + JSON.stringify(obj.$type))
console.info("testWebViewHeightPer type: " + JSON.stringify(obj.$type));
expect(style.height).assertEqual('80%');
console.info("testWebViewHeightPer height is: " + JSON.stringify(style.height));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewHeightPx
* @tc.desc aceEtsTest
*/
it('testWebViewHeightPx', 0, async function (done) {
console.info("testWebViewHeightPx START");
let strJson = getInspectorByKey('webViewHeightPx');
console.log("testWebViewHeightPx strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewHeightPx obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewHeightPx style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewHeightPx type" + JSON.stringify(obj.$type))
console.info("testWebViewHeightPx type: " + JSON.stringify(obj.$type));
expect(style.height).assertEqual("50");
console.info("testWebViewHeightPx height is: " + JSON.stringify(style.height));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewPaddingAll
* @tc.desc aceEtsTest
*/
it('testWebViewPaddingAll', 0, async function (done) {
console.info("testWebViewPaddingAll START");
let strJson = getInspectorByKey('webViewPaddingAll');
console.log("testWebViewPaddingAll strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewPaddingAll obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewPaddingAll style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewPaddingAll type" + JSON.stringify(obj.$type))
expect(style.padding).assertEqual("10");
console.info("testWebViewPaddingAll padding is: " + JSON.stringify(style.padding));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewPadding
* @tc.desc aceEtsTest
*/
it('testWebViewPadding', 0, async function (done) {
console.info("testWebViewPadding START");
let strJson = getInspectorByKey('webViewPadding');
console.log("testWebViewPadding strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewPadding obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewPadding style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewPadding type" + JSON.stringify(obj.$type))
expect(style.padding).assertEqual("{left:10,right:5,top:5,bottom:5}");
console.info("testWebViewPadding padding is: " + JSON.stringify(style.padding));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewMarginAll
* @tc.desc aceEtsTest
*/
it('testWebViewMarginAll', 0, async function (done) {
console.info("testWebViewMarginAll START");
let strJson = getInspectorByKey('webViewMarginAll');
console.log("testWebViewMarginAll strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewMarginAll obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewMarginAll style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewMarginAll type" + JSON.stringify(obj.$type))
expect(style.margin).assertEqual("10");
console.info("testWebViewMarginAll margin is: " + JSON.stringify(style.margin));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewMargin
* @tc.desc aceEtsTest
*/
it('testWebViewMargin', 0, async function (done) {
console.info("testWebViewMargin START");
let strJson = getInspectorByKey('webViewMargin');
console.log("testWebViewMargin strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewMargin obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewMargin style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewMargin type" + JSON.stringify(obj.$type))
expect(style.margin).assertEqual("{left:10,right:5,top:5,bottom:5}");
console.info("testWebViewMargin margin is: " + JSON.stringify(style.margin));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderAll
* @tc.desc aceEtsTest
*/
it('testWebViewBorderAll', 0, async function (done) {
console.info("testWebViewBorderAll START");
let strJson = getInspectorByKey('webViewBorderAll');
console.log("testWebViewBorderAll strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderAll obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderAll style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderAll type" + JSON.stringify(obj.$type))
expect(style.border).assertEqual("{width:2,color:0x317AF7,radius:5,style:BorderStyle.Dashed}");
console.info("testWebViewBorderAll border is: " + JSON.stringify(style.border));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderWidth
* @tc.desc aceEtsTest
*/
it('testWebViewBorderWidth', 0, async function (done) {
console.info("testWebViewBorderWidth START");
let strJson = getInspectorByKey('webViewBorderWidth');
console.log("testWebViewBorderWidth strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderWidth obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderWidth style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderWidth type" + JSON.stringify(obj.$type))
expect(style.borderWidth).assertEqual("3");
console.info("testWebViewBorderWidth borderWidth is: " + JSON.stringify(style.borderWidth));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderColor
* @tc.desc aceEtsTest
*/
it('testWebViewBorderColor', 0, async function (done) {
console.info("testWebViewBorderColor START");
let strJson = getInspectorByKey('webViewBorderColor');
console.log("testWebViewBorderColor strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderColor obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderColor style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderColor type" + JSON.stringify(obj.$type))
expect(style.borderColor).assertEqual("0x317AF7");
console.info("testWebViewBorderColor borderColor is: " + JSON.stringify(style.borderColor));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderRadius
* @tc.desc aceEtsTest
*/
it('testWebViewBorderRadius', 0, async function (done) {
console.info("testWebViewBorderRadius START");
let strJson = getInspectorByKey('webViewBorderRadius');
console.log("testWebViewBorderRadius strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderRadius obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderRadius style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderRadius type" + JSON.stringify(obj.$type))
expect(style.borderRadius).assertEqual("6");
console.info("testWebViewBorderRadius borderRadius is: " + JSON.stringify(style.borderRadius));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderStyleDashed
* @tc.desc aceEtsTest
*/
it('testWebViewBorderStyleDashed', 0, async function (done) {
console.info("testWebViewBorderStyleDashed START");
let strJson = getInspectorByKey('webViewBorderStyleDashed');
console.log("testWebViewBorderStyleDashed strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderStyleDashed obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderStyleDashed style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderStyleDashed type" + JSON.stringify(obj.$type))
expect(style.borderStyle).assertEqual("BorderStyle.Dashed");
console.info("testWebViewBorderStyleDashed borderStyle is: " + JSON.stringify(style.borderStyle));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderStyleSolid
* @tc.desc aceEtsTest
*/
it('testWebViewBorderStyleSolid', 0, async function (done) {
console.info("testWebViewBorderStyleSolid START");
let strJson = getInspectorByKey('webViewBorderStyleSolid');
console.log("testWebViewBorderStyleSolid strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderStyleSolid obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderStyleSolid style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderStyleSolid type" + JSON.stringify(obj.$type))
expect(style.borderStyle).assertEqual("BorderStyle.Solid");
console.info("testWebViewBorderStyleSolid borderStyle is: " + JSON.stringify(style.borderStyle));
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testWebViewBorderStyleDotted
* @tc.desc aceEtsTest
*/
it('testWebViewBorderStyleDotted', 0, async function (done) {
console.info("testWebViewBorderStyleDotted START");
let strJson = getInspectorByKey('webViewBorderStyleDotted');
console.log("testWebViewBorderStyleDotted strJson" + JSON.stringify(strJson))
let obj = JSON.parse(strJson);
console.log("testWebViewBorderStyleDotted obj" + JSON.stringify(obj))
let style = JSON.parse(obj.$attrs)
console.log("testWebViewBorderStyleDotted style" + JSON.stringify(style))
expect(obj.$type).assertEqual('web');
console.log("testWebViewBorderStyleDotted type" + JSON.stringify(obj.$type))
expect(style.borderStyle).assertEqual("BorderStyle.Dotted");
console.info("testWebViewBorderStyleDotted borderStyle is: " + JSON.stringify(style.borderStyle));
done();
});
})
}
{
"color": [
{
"name": "color_hello",
"value": "#ffff0000"
},
{
"name": "color_world",
"value": "#ff0000ff"
}
]
}
\ No newline at end of file
{
"float":[
{
"name":"font_hello",
"value":"28.0fp"
},
{
"name":"font_world",
"value":"20.0fp"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name":"string_hello",
"value":"Hello"
},
{
"name":"string_world",
"value":"World"
},
{
"name":"message_arrive",
"value":"We will arrive at %s."
}
]
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
font-family: verdana, Arial;
font-size: 12px;
line-height:1;
background: #fff;
}
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}
ul {
list-style:none;
}
blockquote, q {
quotes:none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}
a {
margin:0;
padding:0;
text-decoration: none;
font-size:100%;
vertical-align:baseline;
background:transparent;
color: #6c6c6c;
}
a:hover{
color: #f40;
transition: color .2s ease-in-out;
}
/* change colours to suit your needs */
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}
/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
table {
border-collapse:collapse;
border-spacing:0;
}
/* change border colour to suit your needs */
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}
input, select {
vertical-align:middle;
}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
/*ȫ趨*/
body,ul,li,h1,h2,h3,h4,h5,h6,dl,dt,dd,ol,form,table,tr,td,p{ margin:0;padding:0;}
body{ font-family:'';}
a{ font-size:12px; text-decoration:none; color:#999999;}
.left{ float:left;}
.right{ float:right;}
.fontcolorred{ color:red;}
.fontcolorgreen{ color:green;}
.fontcolorblue{ color:blue;}
.fontcolorhui{ color:#666666;}
.fontcolorhei{ color:#000000;}
.fontcolorwhite{ color:#ffffff;}
.fontsize12{ font-size:12px;}
.wzjuzhong{ text-align:center;}
.fontsize14px{ font-size:14px;}
.fontsize16px{ font-size:16px;}
.fontsize18px{ font-size:18px;}
.fontsize22px{ font-size:22px;}
.kongbai{ width:100%;height:5px; line-height:5px; font-size:1px; float:left;}
.fontweightbold{ font-weight:bold;}
.fontweightthin{ font-weight:100;}
.fontfamilyhei{ font-family:'';}
.fontfamilyyahei{ font-family:'΢ź';}
.lineheight22{ line-height:22px;}
.lineheight20{ line-height:20px;}
.lineheightbai{ line-height:100%;}
.padding5{padding:5px;}
.padding10{padding:10px;}
.margin5{margin:5px;}
.marginzong5{margin:5px 0;}
.marginheng5{margin:0 5px;}
.marginzong10{margin:10px 0;}
.marginheng10{margin:0 10px;}
.margintop10{ margin-top:10px;}
.paddingzong5{padding:5px 0;}
.paddingheng5{padding:0 5px;}
.paddingzong10{padding:10px 0;}
.paddingheng10{padding:0 10px;}
.disinline{ display:inline;}
.bordersolid1{ border:1px solid #ddd;}
.borderbottomsolid1{ border-bottom:1px solid #ddd;}
.borderbottomdash1{ border-bottom:1px dashed #ddd;}
.widthbai{ width:100%;}
.widthjuzhong{margin:0 auto;}
.widthin{ width:910px;}
.widthin1000{ width:1000px;}
li{ list-style:none;}
.baiin a{ color:#fff;}
.baiin span{ color:#fff;}
.ohidden{ overflow:hidden;}
/*ͷ*/
.headdi{ height:157px; background:url(../images/nx/headdibg.gif) repeat-x;}
.top{ height:60px;}
.left_menu{ width:300px; float:left;height:60px; text-align:left;overflow:hidden;}
.left_menu h1{width:295px; padding-left:5px; float:left; font-size:14px;height:20px; line-height:20px; margin-top:40px; color:#666666; }
.centerlogo{ width:310px; float:left;height:60px; text-align:center;overflow:hidden;}
.rightmenu{ width:300px; float:left; height:60px;text-align:right;overflow:hidden;}
.rightmenu ul{width:300px; float:left; font-size:12px;height:20px; line-height:20px; margin-top:40px; }
.rightmenu ul li{ display:inline;margin:0 5px;}
.head{height:97px; background:url(../images/nx/head.png) no-repeat center center;}
.nav{ width:910px; float:left; height:40px;margin-top:15px;}
.nav ul{ width:800px; float:left;margin:0 45px 0 65px; display:inline;}
.nav li{ display:inline;float:left; width:87px; margin:7px 11px 3px 11px; text-align:center; font-family:'΢ź';overflow:hidden; line-height:30px; height:30px;font-size:14px; cursor:pointer;}
.focus{ background:#fff1e6; color:#8a420c;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity: 1;opacity: 1;}
.tjtz-main ul {
display:none;
}
.tjtz-main ul.block {
display: block;
}
.menu6 .outer {
color:#ffffff;
}
.menu6 .hover {
background:#fff1e6; color:#8a420c;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity: 1;opacity: 1;
}
.tjtz-main dl{width:290px;margin:0 5px; overflow:hidden;float:left; display:inline;}
.tjtz-main dl h3{ width:290px;height:25px; line-height:25px; text-align:center; background:#d66d41; color:#fff;font-size:14px;}
.tjtz-main dd{ width:288px;height:160px; padding:10px 0; overflow:hidden; float:left; border:1px solid #d66d41;margin-bottom:3px;}
.lefttu{ width:125px;height:140px;padding:5px; float:left;margin:5px 0 0 5px; display:inline; border:1px solid #ddd;}
.lefttu img{width:125px; height:140px;}
.admminfo{ line-height:22px; font-size:12px; width:140px;float:left; display:inline;margin-left:5px;}
.admminfo p{padding:5px 0;}
.admminfo a{ color:#1630f2;}
.red{ color:red;}
.green{ color:green;}
.hottag{width:910px; float:left; height:28px;margin-top:7px; line-height:28px; overflow:hidden;}
.htag{font-size:12px; color:#666666;padding-left:25px; width:460px; height:28px; overflow:hidden;}
.searchk{ width:330px; float:right; margin-top:3px;}
.sea_txt{ width:240px; height:18px;line-height:18px; font-size:12px; border:2px solid #e0e0e0;float:left;}
.sea_btn{ width:51px; height:24px; background:url(../images/nx/seabtn.gif) no-repeat 0 0; margin-left:5px; display:inline; float:left; border:none;}
.tjtz-main{ width:904px; float:left; border-left:1px solid #cc9ea9; background:#fbfbfd; margin-left:2px; display:inline;border-right:1px solid #cc9ea9;border-bottom:1px solid #cc9ea9; }
.pos{ width:904px;float:left; border:1px solid #cc9ea9; background:#fbfbfd; margin-left:2px; display:inline;margin-top:5px;}
.pos h2{ width:900px; height:28px; line-height:28px; color:#ffffff; background:#eb875e; float:left;margin:2px; display:inline; font-size:14px;}
.pos h2 span{ padding:0 5px; display:inline;}
.pos h2 a{ color:#ffffff; text-decoration:none; font-size:14px;}
.pos dl{ width:209px; overflow:hidden; margin:0 2px;padding:0 5px; display:inline; float:left; border-right:1px dotted #ffd2c0;border-top:1px dotted #ffd2c0;}
.pos dl dt{ width:209px; float:left; height:28px; line-height:28px; border-bottom:1px dashed #dddddd;}
.pos dl dt span{ color:#a74017; font-size:12px; font-weight:bold;}
.pos dl dd{ line-height:24px;}
.pos p{ line-height:20px; width:890px; padding:7px; font-size:12px; float:left;}
.pos p a{ text-decoration:none;}
.tjwz{ width:904px;float:left; border:1px solid #cc9ea9; background:#fbfbfd; margin-left:2px; display:inline;margin-top:5px;}
.tjwz h2{ width:900px; height:28px; line-height:28px; color:#ffffff; background:#eb875e; float:left;margin:2px; display:inline; font-size:14px;}
.tjwz h2 span{ padding:0 5px; display:inline;}
.tjwz h2 a{ color:#ffffff; text-decoration:none; font-size:14px;}
.tjwz dl{ line-height:20px; width:890px; padding:3px 7px; font-size:12px;display:inline; float:left;}
.tjwz dl dt{ width:890px; font-weight:bold; float:left; height:26px; line-height:26px; border-bottom:1px dashed #dddddd;}
.tjwz dl dt span{ color:#a74017; font-size:12px; font-weight:bold;}
.tjwz dl dd p{ text-indent:2em;}
.tjwz dl dd{ width:890px;float:left;padding:5px 0; line-height:20px;}
.tjwz ul{ width:870px; padding:5px 10px; float:left; line-height:22px;}
.tjwz li{ display:inline;}
.footmenu{ width:100%; float:left; background:#e37548; height:28px; line-height:28px; margin-top:5px;}
.footmenuin{ width:900px;margin:0 auto;}
.footmenu ul{ width:900px; float:left;color:#ffffff; font-size:10px; text-align:center; }
.footmenu li{ display:inline; margin:0 10px;}
.footmenu li a{ color:#ffffff; font-size:12px;}
/*ײӵ*/
#youlink ul{ width:904px;float:left; border:1px solid #cc9ea9; background:#fbfbfd; margin-left:2px; display:inline;margin-top:5px;}
#youlink ul li{ display:inline; font-size:12px; color:#65454d; margin:0 5px;}
#youlink ul li a{ color:#6e575d; white-space:nowrap;}
.logobot{ width:225px;margin:10px 0; height:69px; border-right:1px solid #ddd; padding:0 5px;}
.bot_menu{ width:600px; height:66px; margin:11px 0;padding:0 10px; font-size:12px; line-height:22px;}
.bot_menu ul li{ display:inline;}
/*listҳ*/
.list-content{ width:910px;margin:0 auto;}
.list-contentin{ width:904px;float:left; border:1px solid #cc9ea9; background:#fff8f6; margin-left:2px; margin-right:2px; display:inline;margin-top:5px;}
.list-contentleft { width:590px; float:left;}
.list-contentleft h2{ width:586px; height:28px; line-height:28px; color:#ffffff; background:#eb875e; float:left;margin:2px 2px 0 2px; display:inline; font-size:14px;}
.list-contentleft h2 span{ padding:0 5px; display:inline;}
.list-contentleft h2 span a{ font-size:14px; color:#ffffff;}
.lcl{ width:583px;float:left; padding-left:1px; border:1px solid #eb875e; margin-left:2px;margin-bottom:2px; display:inline;}
.lcl ul{ width:573px;padding:5px; float:left; color:#333333; }
.lcl ul li{ line-height:22px; border-bottom:1px dashed #dddddd; width:573px; float:left; font-size:12px;}
.lcl ul li a:hover{ color:#cf5224;}
#pages{ font-size:12px;}
.pages{ text-align:center; width:573px; float:left; height:28px; line-height:28px; overflow:hidden; font-size:12px;}
.pages span{padding:5px;font-size:12px;}
.pages a{ padding:5px;font-size:12px;}
.list-contentright{ width:305px; float:left;margin-left:5px; display:inline; background:#ffefe9; margin-top:2px; margin-bottom:2px;}
.lcr-part{ width:300px;padding:0 2px 0 3px; display:inline; float:left;}
.lcr-part h3{ color:#7d2a0a; width:300px; height:28px; line-height:28px; border-bottom:1px solid #ffc2ab; font-size:14px;}
.lcr-part ul{ width:300px;padding:5px; float:left; color:#333333; border-bottom:1px solid #fff3ef; }
.lcr-part ul li{ line-height:20px;width:300px; float:left; font-size:12px;}
.lcr-part ul li a{color:#913b1b;}
.lcr-part ul li a:hover{ color:#cf5224;}
/*ҳ*/
.mian-show_lin{ width:573px;margin:5px; float:left; background:#ffffff; min-height:500px;}
.mian-show_lin h1{ width:547px; text-align:center;margin:10px 13px 5px 13px;line-height:35px; height:35px; overflow:hidden; color:#a5431e; float:left; display:inline;font-size:24px; font-family:'';}
.wzchuqu{ width:547px;height:22px; line-height:22px; overflow:hidden; text-align:center; font-size:12px;margin:0 13px 0 13px; float:left; display:inline;}
.wzchuqu span{margin:0 5px;}
.wzdd{ width:537px;line-height:22px; margin:5px 13px 5px 13px; float:left; display:inline; font-size:14px; background:#ffeee8; padding:5px; color:#a74019;}
.show_content{ width:537px;line-height:25px; margin:5px 13px 5px 13px; float:left; display:inline;padding:5px;font-size:14px; color:#999999;}
.show_content a{ color:#333333; text-decoration:none;}
.showkey{font-size:12px;width:537px;line-height:22px; margin:5px 13px 0 13px; float:left; display:inline;}
.showkey a{color:#9f340c; text-decoration:none; margin:0 10px;}
.show_xgwz{width:537px;line-height:22px; margin:5px 13px 0 13px; float:left; display:inline; font-size:12px;}
.show_xgwz ul{ width:320px; float:left;}
.show_xgwz ul li { width:300px; height:22px; line-height:22px; overflow:hidden;}
.show_xgwz ul li a{ font-size:14px; color:#9f340c; text-decoration:none;}
.fenxiang{width:537px;margin:5px 13px 0 13px; float:left; display:inline;}
\ No newline at end of file
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
//下拉框
(function(){
var num = 0;
$('[data-toggle=arrowdown]').hover(function(){
var _id = $(this).attr('id');
num = _id.substring(5, _id.length);
$(this).find('span')
.removeClass('run-down')
.addClass('run-up');
$('#nav-box'+num).slideDown(100);
}, function(){
$(this).find('span')
.removeClass('run-up')
.addClass('run-down');
$('#nav-box'+num).hide();
});
$('[data-toggle=hidden-box]').hover(function(){
var _id = $(this).attr('id');
num = _id.substring(7, _id.length);
$('#arrow'+num).addClass('nav-hover')
.find('span').removeClass('run-down')
.addClass('run-up');
$(this).show();
}, function(){
$('#arrow'+num).removeClass('nav-hover')
.find('span').removeClass('run-up')
.addClass('run-down');
setTimeout(function(){
$('#arrow'+num).find('span').removeClass('run-down');
}, 500);
$(this).slideUp(100);
});
})(jQuery);
//search-box
(function(){
$('.search-box').hover(function(){
$(this).find('span')
.addClass('down-icon-circle').css({
background: '#f50 url(img/arrow-white.png) no-repeat center'
});
}, function(){
$(this).find('span')
.removeClass('down-icon-circle').css({
background: ''
});
});
})(jQuery);
//滚动出现固定导航
(function(){
$(window).scroll(function(){
var scTop = $(window).scrollTop(),
$scS = $('.scroll-search'),
$frS = $('.fix-right-sub'),
rW;
rW = ($(window).width() - 1190)/2;
scTop >= 200 ? $scS.slideDown(200) : $scS.slideUp(200);
if(scTop >= 2700 && scTop < 4400){
$frS.css({position: 'fixed', top: '-541px', right: rW, marginTop: ''});
}
else if(scTop >= 4400){
$frS.css({position: '', marginTop: 1728});
}
else{
$frS.css({position: ''});
}
});
})(jQuery);
//sidebar
(function(){
var scTop = 0,
beginH = 138,
wW = $(window).width(),
classN,
num;
$(window).scroll(function(){
scTop = $(window).scrollTop();
beginH = 138;
switch (scTop){
case 600: beginH -= 45;break;
case 500: beginH -= 50;break;
case 400: beginH -= 55;break;
case 300: beginH -= 60;break;
case 200: beginH -= 65;break;
default : beginH = 138;break;
}
});
$('.side-li > li').hover(function(){
$(this).find('h3').css({border: 'none'})
.end().find('span').css({color: "#f40"});
classN = $(this).attr('class');
num = classN.substring(2, classN.length);
switch (scTop){
case 0: if(num > 14){ beginH += 120}else if(num >= 12){beginH += 41}; break;
case 100: if(num == 1){beginH -= 27}else if(num == 16){beginH += 7}; break;
case 200: num < 5 ? beginH -= 60 : beginH -= 30; break;
case 300: num < 8 ? beginH -= 60 : beginH -= 40; break;
case 400: num <= 11 ? beginH -= 50 : beginH += 10; break;
case 500: num < 14 ? beginH -= 50 : ''; break;
case 600: num <= 16 ? beginH -= 50 : ''; break;
default : beginH = 138;break;
}
$('.hiden-box').show()
.css({
left: ((wW - 1190)/2 + 149),
top: beginH
}).animate({width: '729px'}, 300);
$('.hiden-box > li').hide();
$('#hiden-'+num).fadeIn(200);
beginH = 138;
}, function(){
$(this).find('h3').css({border: ''})
.end().find('span').css({color: ""});
$('.hiden-box').hide().css({width: '0'});
});
$('.hiden-box').hover(function(){
$('.s_'+num).css({
border: '1px solid #f40',
borderRight: '1px solid #fff'
}).find('h3').css({border: 'none'})
.end().find('span').css({color: "#f40"});
$(this).show().css({width: '729px'});
}, function(){
$('.s_'+num).css({
border: '',
borderRight: ''
}).find('h3').css({border: ''})
.end().find('span').css({color: ""});
$(this).animate({
width: 0
}, 200).hide(200);
});
})();
//关二维码
(function(){
$('.close-code').click(function(){
$('.two-code').fadeOut(200);
});
})();
//service
(function(){
$('.service-cell').hover(function(){
$(this).children('.service-i').find('img').animate({
marginTop: '-10px'
}, 100);
$(this).children('.service-i').find('img').animate({
marginTop: '6px'
}, 100);
}, function(){
return false;
});
})();
//product-box
(function(){
$('.product-box').hover(function(){
$(this).css({
zIndex: '3000'
});
}, function(){
$(this).css({
zIndex: ''
});
});
})();
//product-show
(function(){
$('.product-box').hover(function(){
$(this).find('.share-weitao').fadeIn(200);
}, function(){
$(this).find('.share-weitao').fadeOut(200);
});
})();
//dynamic
(function(){
$('.dynamic').hover(function(){
$(this).find('.follow').fadeIn(200);
}, function(){
$(this).find('.follow').fadeOut(200);
})
})();
//more-btn
(function(){
var flag = 1;
$('.more-btn').click(function(){
if(flag){
$(this).css({
background: '#f40 url(img/up.png) no-repeat 90% center'
});
$('.sub-nav').css({
height: '145px'
});
flag = 0;
}else{
$('.sub-nav').css({
height: ''
});
$(this).css({
background: ''
});
flag = 1;
}
});
})();
/**
* backToTop1
*/
$(document).ready(function(){
$(window).scroll( function() { //滚动时触发
var top = $(document).scrollTop(), //获取滚动条到顶部的垂直高度
height = $(window).height(); //获得可视浏览器的高度
if(top > 100){
$("#backToTop1").show(200, function(){
$("#backToTop1").css({
top: height + top - 100
});
});
}
});
/*点击回到顶部*/
$('#backToTop-up').click(function(){
$('html, body').animate({
scrollTop: 0
}, 500);
});
/*点击到底部*/
$('#backToTop-down').click(function(){
$('html, body').animate({
scrollTop: $(document).height()
}, 500);
});
});
//my-card
(function(){
$('.arrow-right').click(function(){
$('.cards-info ul').animate({
marginLeft: '-205px'
}, 500);
});
$('.arrow-left').click(function(){
$('.cards-info ul').animate({
marginLeft: '0'
}, 500);
});
})();
//msg-close
(function(){
$('.close-msg').click(function(){
$('.read-info').css({
textAlign: 'center'
}).html('还没有新的消息...');
});
})();
//tab-nav
(function(){
$('.li-nav').hover(function(){
var _id, num;
_id = $(this).attr('id');
num = _id.substring(3, _id.length);
$('.li-nav').removeClass('li-nav-hover');
$('.hiddenBox').hide();
$('#box-'+num).fadeIn(200);
}, function(){
$(this).addClass('li-nav-hover');
});
})();
//service-cell
(function(){
$('.service-cell[id]').hover(function(){
var _id, num;
_id = $(this).attr('id');
num = _id.substring(8, _id.length);
$('.service-box').css({
bottom: -50
}).hide();
$('#service-box-'+num).show().animate({
bottom: '0'
}, 200);
$('.service-cell[id]').css({
borderBottomColor: ''
});
$(this).css({
borderBottomColor: '#fff'
});
}, function(){
});
})();
//close-service
(function(){
$('.service-head > .fa-times').click(function(){
$('.service-box').fadeOut(200);
});
})();
//hidden-title
(function(){
$('.hidden-title > a').hover(function(){
$(this).next().css({
color: '#f40'
});
}, function(){
$(this).next().css({
color: ''
});
});
})();
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
function setTab(m,n){
var tli=document.getElementById("menu"+m).getElementsByTagName("li");
var mli=document.getElementById("main"+m).getElementsByTagName("ul");
for(var i=0;i<tli.length;i++){
tli[i].className=i==n?"hover":"outer";
mli[i].style.display=i==n?"block":"none";
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册