提交 46391d09 编写于 作者: D dongwei

add test cases

Signed-off-by: Ndongwei <dongwei@kaihongdigi.com>
上级 6bb17d09
......@@ -55,103 +55,179 @@
"pages/routerReplace/index",
"pages/button/router/index",
"pages/chart/router/index",
"pages/chart/style/index",
"pages/input/prop/index",
"pages/input/router/index",
"pages/input/style/index",
"pages/slider/index",
"pages/slider/router/index",
"pages/slider/style/index",
"pages/text/router/index",
"pages/text/prop/index",
"pages/text/style/index",
"pages/divider/router/index",
"pages/divider/style/index",
"pages/image/router/index",
"pages/image/style/index",
"pages/label/router/index",
"pages/label/prop/index",
"pages/label/style/index",
"pages/rating/prop/index",
"pages/rating/router/index",
"pages/rating/style/index",
"pages/search/router/index",
"pages/search/prop/index",
"pages/toolbar/index",
"pages/search/style/index",
"pages/toolbar/prop/index",
"pages/toolbar/router/index",
"pages/toolbarItem/prop/index",
"pages/toolbarItem/router/index",
"pages/textarea/prop/index",
"pages/textarea/router/index",
"pages/textarea/style/index",
"pages/menu/router/index",
"pages/menu/style/index",
"pages/span/router/index",
"pages/switch/router/index",
"pages/toggle/index",
"pages/switch/style/index",
"pages/toggle/prop/index",
"pages/toggle/router/index",
"pages/toggle/style/index",
"pages/option/router/index",
"pages/option/prop/index",
"pages/option/style/index",
"pages/picker/router/index",
"pages/picker/prop/index",
"pages/picker/style/index",
"pages/pickerView/router/index",
"pages/pickerView/prop/index",
"pages/pickerView/style/index",
"pages/piece/router/index",
"pages/piece/prop/index",
"pages/piece/style/index",
"pages/progress/router/index",
"pages/progress/prop/index",
"pages/qrcode/index",
"pages/progress/style/index",
"pages/qrcode/prop/index",
"pages/qrcode/router/index",
"pages/qrcode/style/index",
"pages/select/prop/index",
"pages/select/router/index",
"pages/select/style/index",
"pages/div/router/index",
"pages/badge/router/index",
"pages/badge/prop/index",
"pages/badge/style/index",
"pages/dialog/router/index",
"pages/dialog/prop/index",
"pages/dialog/style/index",
"pages/form/router/index",
"pages/form/prop/index",
"pages/form/style/index",
"pages/list/router/index",
"pages/list/prop/index",
"pages/list/style/index",
"pages/listItem/router/index",
"pages/listItem/prop/index",
"pages/listItem/style/index",
"pages/listItemGroup/router/index",
"pages/listItemGroup/prop/index",
"pages/listItemGroup/style/index",
"pages/marquee/router/index",
"pages/marquee/prop/index",
"pages/marquee/style/index",
"pages/imageAnimator/prop/index",
"pages/imageAnimator/router/index",
"pages/imageAnimator/style/index",
"pages/panel/router/index",
"pages/panel/prop/index",
"pages/panel/style/index",
"pages/popup/router/index",
"pages/popup/prop/index",
"pages/popup/style/index",
"pages/refresh/router/index",
"pages/refresh/prop/index",
"pages/refresh/style/index",
"pages/stack/router/index",
"pages/stack/prop/index",
"pages/stack/style/index",
"pages/stepper/router/index",
"pages/stepper/prop/index",
"pages/stepper/style/index",
"pages/stepperItem/router/index",
"pages/stepperItem/prop/index",
"pages/stepperItem/style/index",
"pages/swiper/router/index",
"pages/swiper/prop/index",
"pages/swiper/style/index",
"pages/tabs/router/index",
"pages/tabs/prop/index",
"pages/tabs/style/index",
"pages/tab-bar/router/index",
"pages/tab-bar/prop/index",
"pages/tab-bar/style/index",
"pages/tab-content/router/index",
"pages/tab-content/prop/index",
"pages/svg_text/index",
"pages/tab-content/style/index",
"pages/svg_text/prop/index",
"pages/svg_text/router/index",
"pages/video/prop/index",
"pages/video/router/index",
"pages/gridContainer/prop/index",
"pages/gridContainer/router/index",
"pages/gridRow/index",
"pages/gridCol/index",
"pages/canvas/index",
"pages/obj_CanvasRenderingContext2D/index",
"pages/obj_Image/index",
"pages/obj_CanvasGradient/index",
"pages/obj_ImageData/index",
"pages/obj_Path2D/index",
"pages/obj_ImageBitmap/index",
"pages/obj_OffscreenCanvas/index",
"pages/obj_OffscreenCanvasRenderingContext2D/index",
"pages/ellipse/index",
"pages/path/index",
"pages/line/index",
"pages/polyline/index",
"pages/polygon/index",
"pages/animate/index",
"pages/animateMotion/index",
"pages/animateTransform/index",
"pages/textPath/index",
"pages/tspan/index",
"pages/gridContainer/style/index",
"pages/gridRow/prop/index",
"pages/gridRow/router/index",
"pages/gridRow/style/index",
"pages/gridCol/prop/index",
"pages/gridCol/router/index",
"pages/gridCol/style/index",
"pages/canvas/prop/index",
"pages/canvas/router/index",
"pages/canvas/style/index",
"pages/obj_CanvasRenderingContext2D/router/index",
"pages/obj_CanvasRenderingContext2D/prop/index",
"pages/obj_CanvasRenderingContext2D/style/index",
"pages/obj_Image/router/index",
"pages/obj_Image/prop/index",
"pages/obj_Image/style/index",
"pages/obj_CanvasGradient/router/index",
"pages/obj_CanvasGradient/prop/index",
"pages/obj_CanvasGradient/style/index",
"pages/obj_ImageData/router/index",
"pages/obj_ImageData/prop/index",
"pages/obj_ImageData/style/index",
"pages/obj_Path2D/router/index",
"pages/obj_Path2D/prop/index",
"pages/obj_Path2D/style/index",
"pages/obj_ImageBitmap/router/index",
"pages/obj_ImageBitmap/prop/index",
"pages/obj_ImageBitmap/style/index",
"pages/obj_OffscreenCanvas/router/index",
"pages/obj_OffscreenCanvas/prop/index",
"pages/obj_OffscreenCanvas/style/index",
"pages/obj_OffscreenCanvasRenderingContext2D/router/index",
"pages/obj_OffscreenCanvasRenderingContext2D/prop/index",
"pages/obj_OffscreenCanvasRenderingContext2D/style/index",
"pages/ellipse/prop/index",
"pages/ellipse/router/index",
"pages/path/prop/index",
"pages/path/router/index",
"pages/line/prop/index",
"pages/line/style/index",
"pages/polyline/prop/index",
"pages/polyline/router/index",
"pages/polygon/prop/index",
"pages/polygon/router/index",
"pages/animate/prop/index",
"pages/animate/router/index",
"pages/animateMotion/prop/index",
"pages/animateMotion/router/index",
"pages/animateTransform/prop/index",
"pages/animateTransform/router/index",
"pages/textPath/prop/index",
"pages/textPath/router/index",
"pages/tspan/prop/index",
"pages/tspan/router/index",
"pages/div/prop/index",
"pages/div/style/index",
"pages/divider/prop/index",
......@@ -160,6 +236,7 @@
"pages/chart/prop/index",
"pages/image/prop/index",
"pages/span/prop/index",
"pages/span/style/index",
"pages/menu/prop/index",
"pages/switch/prop/index",
"pages/slider/prop/index",
......@@ -168,7 +245,10 @@
"pages/rect/prop/index",
"pages/rect/router/index",
"pages/circle/prop/index",
"pages/circle/router/index"
"pages/circle/router/index",
"pages/richtext/prop/index",
"pages/richtext/router/index",
"pages/richtext/style/index"
],
"name": "default",
"window": {
......
/*
* 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 router from '@system.router';
import {describe, beforeAll,afterAll, it, expect} from 'deccjsunit/index';
describe('richtextPropsJsTest', function () {
async function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
async function backToIndex() {
let backToIndexPromise = new Promise((resolve, reject) => {
setTimeout(() => {
router.back({
uri: 'pages/index/index'
});
resolve();
}, 500);
});
let clearPromise = new Promise((resolve, reject) => {
setTimeout(() => {
router.clear();
resolve();
}, 500);
});
await backToIndexPromise.then(() => {
return clearPromise;
});
}
/**
* run before testcase
*/
beforeAll(async function (done) {
console.info('[richtextPropsJsTest] before each called')
let result;
let options = {
uri: 'pages/richtext/prop/index'
}
try {
result = router.push(options)
console.info("push richtextProps page success " + JSON.stringify(result));
} catch (err) {
console.error("push richtextProps page error " + JSON.stringify(result));
}
await sleep(4000)
done()
});
/**
* run after testcase
*/
afterAll(async function () {
console.info('[richtextPropsJsTest] after each called')
await backToIndex()
await sleep(1000)
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
* @tc.name testRichtextIdProp
* @tc.desc ACE
*/
it('testRichtextIdProp', 0, async function (done) {
console.info('testRichtextIdProp START');
console.info("[richtextProps] get globalThis.value is: " + JSON.stringify(globalThis.value));
let obj = JSON.parse(globalThis.value.idProp);
console.info("[richtextProps] get inspector value is: " + JSON.stringify(obj));
console.info("[richtextProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs));
expect(obj.$type).assertEqual('richtext')
expect(obj.$attrs.id).assertEqual('idProp')
done();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
* @tc.name testRichtextClassProp
* @tc.desc ACE
*/
it('testRichtextClassProp', 0, async function (done) {
console.info('testRichtextClassProp START');
console.info("[richtextProps] get globalThis.value is: " + JSON.stringify(globalThis.value));
let obj = JSON.parse(globalThis.value.classProp);
console.info("[richtextProps] get inspector value is: " + JSON.stringify(obj));
console.info("[richtextProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs));
expect(obj.$type).assertEqual('richtext')
expect(obj.$attrs.id).assertEqual('classProp')
expect(obj.$attrs.className).assertEqual('classProp')
done();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
* @tc.name testRichtextClassPropNone
* @tc.desc ACE
*/
it('testRichtextClassPropNone', 0, async function (done) {
console.info('testRichtextClassPropNone START');
console.info("[richtextProps] get globalThis.value is: " + JSON.stringify(globalThis.value));
let obj = JSON.parse(globalThis.value.classPropNone);
console.info("[richtextProps] get inspector value is: " + JSON.stringify(obj));
console.info("[richtextProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs));
expect(obj.$type).assertEqual('richtext')
expect(obj.$attrs.id).assertEqual('classPropNone')
expect(obj.$attrs.className).assertEqual(undefined)
console.info("[richtextProps] get className value is: " + JSON.stringify(obj.$attrs.className));
done();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
* @tc.name testRichtextStyleProp
* @tc.desc ACE
*/
it('testRichtextStyleProp', 0, async function (done) {
console.info('testRichtextStyleProp START');
console.info("[richtextProps] get globalThis.value is: " + JSON.stringify(globalThis.value));
let obj = JSON.parse(globalThis.value.styleProp);
console.info("[richtextProps] get inspector value is: " + JSON.stringify(obj));
console.info("[richtextProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs));
expect(obj.$type).assertEqual('richtext')
expect(obj.$attrs.id).assertEqual('styleProp')
expect(obj.$attrs.style).assertEqual('visibility: visible;')
console.info("[richtextProps] get className value is: " + JSON.stringify(obj.$attrs.className));
done();
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册