diff --git a/pages.json b/pages.json
index 41538bc01da1ab04407d102539fbb90644b0bc96..dcfce5fe9f8f38bfa290a7f45dcec104e302f597 100644
--- a/pages.json
+++ b/pages.json
@@ -1309,13 +1309,13 @@
"navigationBarTitleText": "日历"
}
},
+ // #endif
{
"path": "pages/template/schema/schema",
"style": {
"navigationBarTitleText": "打开schema示例"
}
},
- // #endif
// #ifdef APP-ANDROID
{
"path": "pages/template/share/share",
@@ -1380,13 +1380,13 @@
"enablePullDownRefresh": false
}
},
- {
- "path": "pages/API/theme-change/theme-change",
- "style": {
- "navigationBarTitleText": "主题切换",
- "enablePullDownRefresh": false
- }
- },
+ // {
+ // "path": "pages/API/theme-change/theme-change",
+ // "style": {
+ // "navigationBarTitleText": "主题切换",
+ // "enablePullDownRefresh": false
+ // }
+ // },
{
"path": "uni_modules/uni-pay-x/pages/success/success",
"style": {
@@ -1434,7 +1434,6 @@
"backgroundColorContent": "#fffae8"
}
},
- // #ifdef APP-ANDROID || WEB
{
"path" : "pages/API/resize-observer/resize-observer",
"style" :
@@ -1442,7 +1441,6 @@
"navigationBarTitleText" : "resize observer"
}
},
- // #endif
{
"path" : "pages/CSS/overflow/overflow-visible-event",
"style" :
diff --git a/pages/API/env/env.uvue b/pages/API/env/env.uvue
index b9004a9f2b761d6b57c74fc22313b3e135cc9621..adce29875ced55fc07f18074c1537561466d39a6 100644
--- a/pages/API/env/env.uvue
+++ b/pages/API/env/env.uvue
@@ -33,7 +33,10 @@
methods: {
geAbsPath(path ?: Any) {
- this.log += UTSAndroid.convert2AbsFullPath(path as String) + '\n'
+ // #ifdef APP-ANDROID
+ this.log += UTSAndroid.convert2AbsFullPath(path as String) + '\n'
+ // #endif
+
}
}
}
diff --git a/pages/API/get-battery-info/get-battery-info.uvue b/pages/API/get-battery-info/get-battery-info.uvue
index 84c733122cd8c9ecef08ac92427092724fb49184..e55d296d8d38c0218e77ce15956040fcc8956f1d 100644
--- a/pages/API/get-battery-info/get-battery-info.uvue
+++ b/pages/API/get-battery-info/get-battery-info.uvue
@@ -1,28 +1,33 @@
-
- 当前电量:{{level}}%
- 是否充电中:{{isCharging}}
-
+
+ 当前电量:{{level}}%
+ 是否充电中:{{isCharging}}
+
-
\ No newline at end of file
diff --git a/pages/API/get-file-system-manager/get-file-system-manager.test.js b/pages/API/get-file-system-manager/get-file-system-manager.test.js
index 45ccdedf3572e3b03010c75c36cbf82be1a03a5b..090247311d5d7d6d3f25dcf3dd53e98cfe39e3de 100644
--- a/pages/API/get-file-system-manager/get-file-system-manager.test.js
+++ b/pages/API/get-file-system-manager/get-file-system-manager.test.js
@@ -97,10 +97,10 @@ describe('ExtApi-FileManagerTest', () => {
let lastFailError = await getData('lastFailError')
expect(lastFailError.errCode).toEqual(1300002)
- expect(lastFailError.errMsg).toEqual('no such file or directory:unifile://usr/a/b/c')
+ expect(lastFailError.errMsg).toEqual('no such file or directory')
let lastCompleteError = await getData('lastCompleteError')
expect(lastCompleteError.errCode).toEqual(1300002)
- expect(lastCompleteError.errMsg).toEqual('no such file or directory:unifile://usr/a/b/c')
+ expect(lastCompleteError.errMsg).toEqual('no such file or directory')
// 测试 recursive = true 期望文件夹创建成功
diff --git a/pages/API/get-system-info/get-system-info.test.js b/pages/API/get-system-info/get-system-info.test.js
index f8b2f9d3494ba8c06bd810dd1f0a5667942b85e2..9cc4c2da4c0ba1992d4c6847eabe66ced211aa81 100644
--- a/pages/API/get-system-info/get-system-info.test.js
+++ b/pages/API/get-system-info/get-system-info.test.js
@@ -1,55 +1,53 @@
-const PAGE_PATH = '/pages/API/get-system-info/get-system-info'
-
-describe('ExtApi-GetSystemInfo', () => {
-
- let page;
- let res;
- const stringProperties = [
- 'appId', 'appLanguage', 'appName', 'appVersion', 'appVersionCode',
- 'brand', 'deviceId', 'deviceBrand', 'deviceModel', 'deviceType', 'language',
- 'model', 'osName', 'osVersion', 'osLanguage', 'platform', 'system', 'ua', 'uniCompilerVersion',
- 'uniPlatform', 'uniRuntimeVersion', 'romName', 'romVersion',
- ]
- const numberProperties = [
- 'osAndroidAPILevel', 'devicePixelRatio', 'pixelRatio', 'screenWidth', 'screenHeight', 'statusBarHeight',
- 'windowWidth',
- 'windowHeight', 'windowTop', 'windowBottom', 'screenTop',
- 'uniCompilerVersionCode', 'uniRuntimeVersionCode'
+const PAGE_PATH = '/pages/API/get-system-info/get-system-info'
+
+describe('ExtApi-GetSystemInfo', () => {
+
+ let page;
+ let res;
+ const stringProperties = [
+ 'appId', 'appLanguage', 'appName', 'appVersion', 'appVersionCode',
+ 'brand', 'deviceId', 'deviceBrand', 'deviceModel', 'deviceType', 'language',
+ 'model', 'osName', 'osVersion', 'osLanguage', 'platform', 'system', 'ua', 'uniCompilerVersion',
+ 'uniPlatform', 'uniRuntimeVersion', 'romName', 'romVersion',
+ ]
+ const numberProperties = [
+ 'osAndroidAPILevel', 'devicePixelRatio', 'pixelRatio', 'screenWidth', 'screenHeight', 'statusBarHeight',
+ 'windowWidth',
+ 'windowHeight', 'windowTop', 'windowBottom', 'screenTop',
+ 'uniCompilerVersionCode', 'uniRuntimeVersionCode'
]
const booleanProperties = [
- 'isUniAppX'
]
const requiredProperties = [
'uniCompilerVersion',
'uniCompilerVersionCode',
'uniRuntimeVersion',
- 'uniRuntimeVersionCode',
- 'isUniAppX'
- ]
-
- beforeAll(async () => {
- page = await program.reLaunch(PAGE_PATH)
- await page.waitFor(600);
- res = await page.callMethod('jest_getSystemInfo')
- });
- it('Check GetSystemInfoSync', async () => {
- for (const key in res) {
- const value = res[key];
- console.log("key :",key , "value :", value);
- if (stringProperties.indexOf(key) != -1) {
+ 'uniRuntimeVersionCode'
+ ]
+
+ beforeAll(async () => {
+ page = await program.reLaunch(PAGE_PATH)
+ await page.waitFor(600);
+ res = await page.callMethod('jest_getSystemInfo')
+ });
+ it('Check GetSystemInfoSync', async () => {
+ for (const key in res) {
+ const value = res[key];
+ console.log("key :",key , "value :", value);
+ if (stringProperties.indexOf(key) != -1) {
expect(value).not.toBeNull();
- expect(value).not.toBe("");
- }
- if (numberProperties.indexOf(key) != -1) {
+ expect(value).not.toBe("");
+ }
+ if (numberProperties.indexOf(key) != -1) {
expect(value).not.toBeNull();
- expect(value).toBeGreaterThanOrEqual(0);
- }
- if (booleanProperties.indexOf(key) != -1) {
+ expect(value).toBeGreaterThanOrEqual(0);
+ }
+ if (booleanProperties.indexOf(key) != -1) {
expect(value).not.toBeNull();
- expect(typeof value).toBe('boolean');
- }
- if (key == 'deviceOrientation') {
- expect(['portrait', 'landscape']).toContain(value);
+ expect(typeof value).toBe('boolean');
+ }
+ if (key == 'deviceOrientation') {
+ expect(['portrait', 'landscape']).toContain(value);
}
if (key == "osTheme") {
expect(['light', 'dark']).toContain(value);
@@ -57,12 +55,12 @@ describe('ExtApi-GetSystemInfo', () => {
if (key == "appTheme") {
expect(['light', 'dark', 'auto']).toContain(value);
}
- }
+ }
});
it('Check GetSystemInfoSync required properties', async () => {
for (let i = 0; i < requiredProperties.length; i++) {
const key = requiredProperties[i]
expect(`${key} not null: ${res[key] != null}`).toBe(`${key} not null: true`)
}
- })
+ })
});
diff --git a/pages/API/map/map.test.js b/pages/API/map/map.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f1dd4cde0e1699d7af5af9814f11a35c57ae261c
--- /dev/null
+++ b/pages/API/map/map.test.js
@@ -0,0 +1,52 @@
+const PAGE_PATH = '/pages/API/map/map'
+let page;
+describe('web-map', () => {
+ console.log("uniTestPlatformInfo",process.env.uniTestPlatformInfo)
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch(PAGE_PATH)
+ await page.waitFor('view');
+ // 等待地图加载完成
+ await page.waitFor(4000);
+ await page.setData({autoTest:true})
+ });
+
+ it('Check MapMethods', async () => {
+ const mapMethods = ['changeScale', 'addMarkers', 'addPolyline', 'addPolygons', 'addCircles',
+ 'includePoint', 'handleTranslateMarker'
+ ]
+ for (var i = 0; i < mapMethods.length; i++) {
+ await page.callMethod(mapMethods[i])
+ if (mapMethods[i] == 'handleTranslateMarker') {
+ await page.waitFor(2000);
+ } else {
+ await page.waitFor(500);
+ }
+ expect(await program.screenshot()).toSaveImageSnapshot();
+ await page.waitFor(500);
+ }
+ });
+ it('handleGetCenterLocation', async () => {
+ await page.callMethod('handleGetCenterLocation')
+ await page.waitFor(500);
+ const centerLocationRes = await page.data('getCenterLocationTest')
+ expect(centerLocationRes.latitude).not.toBeNull();
+ expect(centerLocationRes.longitude).not.toBeNull();
+ });
+ it('handleGetRegion', async () => {
+ await page.callMethod('handleGetRegion')
+ await page.waitFor(500);
+ const regionRes = await page.data('getRegionTest')
+ const getRegionExpected = {
+ southwest: { latitude: 39.88334279187766, longitude: 116.31050146728515 },
+ northeast: { latitude: 40.0149408585477, longitude: 116.56799353271484 },
+ errMsg: 'getRegion:ok'
+ }
+ expect(regionRes).toEqual(expect.objectContaining(getRegionExpected));
+ });
+});
diff --git a/pages/API/map/map.uvue b/pages/API/map/map.uvue
index f4dbf29e2aec94f3dd5b545820e6462ca477818d..e2d03bba1493882c09a60eadbfa7a2d9238f9a40 100644
--- a/pages/API/map/map.uvue
+++ b/pages/API/map/map.uvue
@@ -304,7 +304,11 @@
includePoints: [] as Points[],
rotate: 0,
skew: 0,
- map: null as MapContext | null
+ map: null as MapContext | null,
+ // 自动化测试
+ autoTest: false,
+ getCenterLocationTest:{},
+ getRegionTest:{},
}
},
onReady() {
@@ -359,9 +363,12 @@
this.map!.getCenterLocation({
success: ret => {
console.log(JSON.stringify(ret));
- uni.showModal({
- content: JSON.stringify(ret)
- })
+ this.getCenterLocationTest = ret
+ if(!this.autoTest){
+ uni.showModal({
+ content: JSON.stringify(ret)
+ })
+ }
}
})
},
@@ -369,9 +376,12 @@
this.map!.getRegion({
success: ret => {
console.log(JSON.stringify(ret));
- uni.showModal({
- content: JSON.stringify(ret)
- })
+ this.getRegionTest = ret
+ if(!this.autoTest){
+ uni.showModal({
+ content: JSON.stringify(ret)
+ })
+ }
}
})
},
diff --git a/pages/API/request-payment/reqeust-payment.test.js b/pages/API/request-payment/reqeust-payment.test.js
index 2c4fd3b20431c9608837cdd75514ff269ceef8fd..1e314a311da5d1ac16adb81a833cf977320d431b 100644
--- a/pages/API/request-payment/reqeust-payment.test.js
+++ b/pages/API/request-payment/reqeust-payment.test.js
@@ -18,8 +18,8 @@ describe("payment", () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600)
});
- //支付失败700711
- it("errorcode700711", async () => {
+ //支付失败701100
+ it("errorcode701100", async () => {
let orderInfo =
"service=\"mobile.securitypay.pay\"&partner=\"2088801273866834\"&_input_charset=\"UTF-8\"&out_trade_no=\"20240229115452\"&subject=\"DCloud项目捐赠\"&payment_type=\"1\"&seller_id=\"payservice@dcloud.io\"&total_fee=\"0.01\"&body=\"DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。\"&it_b_pay=\"1d\"¬ify_url=\"http%3A%2F%2Fdemo.dcloud.net.cn%2Fpayment%2Falipay%2Fnotify.php\"&show_url=\"http%3A%2F%2Fwww.dcloud.io%2Fhelloh5%2F\"&sign=\"diZdkTX2iIP1oZh25UCGqx%2BpkViqAN8xdvMNSJF79aq0JiunX2mtr%2BbNlDsP0YL5x85KjULsqx%2Fq%2B5wij6eMoBVeJ%2BHhyjkwt0PYuwntroJ2Ho8bdUVEybBgOjy240NbCUtKmZzNRQAGsmLztKWzsg1srsQ8Se3Qi8KGDaOhqBs%3D\"&sign_type=\"RSA\"";
await page.setData({
@@ -29,6 +29,6 @@ describe("payment", () => {
await page.waitFor(async () => {
return await page.data('complete') === true;
});
- expect((await page.data())['errorCode']).toEqual(700711)
+ expect((await page.data())['errorCode']).toEqual(701100)
});
});
diff --git a/pages/API/resize-observer/resize-observer.test.js b/pages/API/resize-observer/resize-observer.test.js
index 22160835196358c0332b10f71d7863294c9283e4..ad6de613af2bfc44912faf0f1d4dbf39d48b88f1 100644
--- a/pages/API/resize-observer/resize-observer.test.js
+++ b/pages/API/resize-observer/resize-observer.test.js
@@ -1,13 +1,5 @@
describe('api-resize-observer', () => {
- if (
- !process.env.uniTestPlatformInfo.startsWith('android') &&
- !process.env.uniTestPlatformInfo.startsWith('web')
- ) {
- it('dummyTest', async () => {
- expect(1).toBe(1)
- })
- return
- }
+
let page
beforeAll(async () => {
diff --git a/pages/API/resize-observer/resize-observer.uvue b/pages/API/resize-observer/resize-observer.uvue
index d2377add5f940a4bcfabd86e00dacaefc8f84f28..b8a60099211c4e2a87ec626ff4b3f07638486cf6 100644
--- a/pages/API/resize-observer/resize-observer.uvue
+++ b/pages/API/resize-observer/resize-observer.uvue
@@ -4,13 +4,15 @@
+ id="outBox" @click="outBoxClick">
-
+
+
+
蓝色方块元素:
@@ -34,7 +36,7 @@
boxDisplay: false,
outBoxElement: null as UniElement | null,
innerBoxElement: null as UniElement | null,
- resizeObserver: null as UniResizeObserver | null,
+ resizeObserver: null as UniResizeObserver | null,
outBoxElementOnResize: false
}
},
@@ -47,9 +49,10 @@
onReady() {
if (this.resizeObserver == null) {
this.resizeObserver = new UniResizeObserver((entries : Array) => {
+
entries.forEach(entry => {
if (entry.target == this.outBoxElement) {
- this.outBoxSizeInfo = this.analysisResizeObserverEntry(entry)
+ this.outBoxSizeInfo = this.analysisResizeObserverEntry(entry)
this.outBoxElementOnResize = true
} else if (entry.target == this.innerBoxElement) {
this.innerBoxSizeInfo = this.analysisResizeObserverEntry(entry)
@@ -63,7 +66,7 @@
this.innerBoxElement = uni.getElementById("innerBox")
if (this.innerBoxElement != null) {
this.resizeObserver!.observe(this.innerBoxElement!)
- }
+ }
this.boxDisplay = true
}
},
@@ -89,13 +92,13 @@
this.innerBoxElement!.style.setProperty("width", "80px")
this.innerBoxElement!.style.setProperty("height", "80px")
}
- },
- //自动化测试专用
- setOutBoxMarginLeft(value: string) {
- if (this.outBoxElement != null) {
- this.outBoxElementOnResize = false
- this.outBoxElement!.style.setProperty("margin-left", value)
- }
+ },
+ //自动化测试专用
+ setOutBoxMarginLeft(value : string) {
+ if (this.outBoxElement != null) {
+ this.outBoxElementOnResize = false
+ this.outBoxElement!.style.setProperty("margin-left", value)
+ }
},
toggleDisplay() {
this.boxDisplay = !this.boxDisplay
@@ -108,6 +111,15 @@
"contentBoxSize: \n{blockSize:" + contentBoxSize.blockSize + ", inlineSize:" + contentBoxSize.inlineSize + "}\n" +
"devicePixelContentBoxSize: \n{blockSize:" + devicePixelContentBoxSize.blockSize + ", inlineSize:" + devicePixelContentBoxSize.inlineSize + "}\n" +
"contentRect: \n{x:" + entry.contentRect.x + ", y:" + entry.contentRect.y + ", width:" + entry.contentRect.width + ", height:" + entry.contentRect.height + "}"
+ },
+ cancelListen(){
+ // this.resizeObserver?.unobserve()
+ this.resizeObserver!.unobserve(this.outBoxElement!)
+ this.resizeObserver!.unobserve(this.innerBoxElement!)
+ },
+ goOnListen(){
+ this.resizeObserver!.observe(this.outBoxElement!)
+ this.resizeObserver!.observe(this.innerBoxElement!)
}
}
}
diff --git a/pages/API/theme-change/theme-change.uvue b/pages/API/theme-change/theme-change.uvue
index 9c3b662aebad42b194792efba1834638b950496b..4afff9df03afb8b1912033de755b4fe6002a4d2a 100644
--- a/pages/API/theme-change/theme-change.uvue
+++ b/pages/API/theme-change/theme-change.uvue
@@ -1,14 +1,14 @@
-
+
theme:
{{ dataInfo.theme }}
-
+
fn1 trigger num:
{{ dataInfo.fn1TriggerNum }}
-
+
fn2 trigger num:
{{ dataInfo.fn2TriggerNum }}
@@ -73,13 +73,9 @@ onReady(() => {
diff --git a/pages/component/editor/editor.test.js b/pages/component/editor/editor.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6648ba7b908ce654cf3843f762b41d41d70b41fe
--- /dev/null
+++ b/pages/component/editor/editor.test.js
@@ -0,0 +1,90 @@
+// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+jest.setTimeout(60000);
+describe('editor.uvue', () => {
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ let page, editor, options = [];
+ beforeAll(async () => {
+ page = await program.reLaunch("/pages/component/editor/editor");
+ await page.waitFor('view');
+ editor = await page.$('#editor');
+ await page.waitFor(3000);
+ await page.setData({autoTest:true})
+ });
+
+ it('editor-wrapper', async () => {
+ expect(await editor.attribute("placeholder")).toBe("开始输入...")
+ expect(await editor.attribute("read-only")).toBe("false")
+ });
+
+ it('editor-toolbar', async () => {
+ const iconfontsEl = await page.$$('.iconfont');
+ for (var i = 0; i < iconfontsEl.length - 7; i++) {
+ await iconfontsEl[i].tap()
+ // await page.waitFor(500)
+ const getFormats = await page.data('formats')
+ const name = await iconfontsEl[i].attribute('data-name')
+ options.push({
+ insert:'文本内容' + name,
+ attributes: getFormats
+ })
+ await page.callMethod('setContents', options)
+ await page.setData({
+ formats: {}
+ })
+ await iconfontsEl[i].tap()
+ }
+ });
+
+ it('editor-screenshot', async () => {
+ expect(await program.screenshot()).toSaveImageSnapshot();
+ await page.waitFor(500);
+ })
+
+ it('clear', async () => {
+ await page.callMethod('clear')
+ await page.waitFor(500)
+ expect(await editor.attribute("placeholder")).toBe("开始输入...")
+ })
+
+ it('undo-redo', async () => {
+ await page.callMethod('insertDate')
+ await page.callMethod('insertDivider')
+ await page.waitFor(500)
+ await page.callMethod('undo')
+ await page.waitFor(500)
+ expect(await page.data('undoTest')).toBe(true)
+ await page.callMethod('redo')
+ await page.waitFor(500)
+ expect(await page.data('redoTest')).toBe(true)
+ })
+
+ it('insertImage', async () => {
+ await page.callMethod('insertImage','https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png')
+ await page.waitFor(500)
+ expect(await program.screenshot()).toSaveImageSnapshot();
+ })
+
+ it('removeFormat', async () => {
+ const bgcolorEl = await page.$('.icon-fontbgcolor');
+ await bgcolorEl.tap()
+ await page.waitFor(500)
+ const getFormats = await page.data('formats')
+ await page.callMethod('setContents', [
+ {
+ insert: '设置字体样式bgcolor',
+ attributes: getFormats
+ }
+ ])
+ await page.waitFor(500)
+ await page.callMethod('removeFormat')
+ await page.waitFor(500)
+ expect(await page.data('removeFormatTest')).toBe(true)
+ expect(await page.data('formats')).toEqual({})
+ })
+
+});
diff --git a/pages/component/editor/editor.uvue b/pages/component/editor/editor.uvue
index 8f7392bce9b7805031a7a39bb1959586b9b23101..88edd341480d0e1dc8851aebd0e1c47bb7ac2b5a 100644
--- a/pages/component/editor/editor.uvue
+++ b/pages/component/editor/editor.uvue
@@ -30,7 +30,7 @@
data-name="marginTop" data-value="20px">
-
+
-
+
-
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
@@ -86,7 +94,12 @@
return {
readOnly: false,
formats: {},
- editorCtx:{} as Context
+ editorCtx:{} as Context,
+ // 自动化测试
+ autoTest:false,
+ undoTest:false,
+ redoTest:false,
+ removeFormatTest:false
}
},
onLoad() {
@@ -110,6 +123,20 @@
this.editorCtx = res.context
}).exec()
},
+ // 自动化测试专用
+ setContents(options) {
+ this.editorCtx.setContents({
+ delta: {
+ ops:options
+ },
+ success: (res) => {
+ console.log('setContents-success', res)
+ },
+ fail: (err) => {
+ console.log(err)
+ }
+ })
+ },
getCon() {
this.editorCtx.getContents({
success: (res) => {
@@ -121,16 +148,27 @@
})
},
undo() {
- this.editorCtx.undo()
+ this.editorCtx.undo({
+ success: (res) => {
+ this.undoTest = true
+ },
+ fail: (err) => {
+ this.undoTest = false
+ }
+ })
},
redo() {
- this.editorCtx.redo()
+ this.editorCtx.redo({
+ success: (res) => {
+ this.redoTest = true
+ },
+ fail: (err) => {
+ this.redoTest = false
+ }
+ })
},
format(e) {
- let {
- name,
- value
- } = e.target.dataset
+ let {name,value} = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
@@ -146,23 +184,34 @@
}
})
},
- clear() {
- uni.showModal({
- title: '清空编辑器',
- content: '确定清空编辑器全部内容?',
- success: res => {
- if (res.confirm) {
- this.editorCtx.clear({
- success: function(res) {
- console.log("clear success")
- }
- })
- }
- }
- })
+ clear() {
+ this.editorCtx.clear({
+ success: function(res) {
+ console.log("clear success")
+ }
+ })
+ },
+ clearShowModal() {
+ uni.showModal({
+ title: '清空编辑器',
+ content: '确定清空编辑器全部内容?',
+ success: res => {
+ if (res.confirm) {
+ this.clear()
+ }
+ }
+ })
},
removeFormat() {
- this.editorCtx.removeFormat()
+ this.editorCtx.removeFormat({
+ success: (res) => {
+ console.log('removeFormat-success', res)
+ this.removeFormatTest = true
+ },
+ fail: (err) => {
+ this.removeFormatTest = false
+ }
+ })
},
insertDate() {
const date = new Date()
@@ -171,19 +220,22 @@
text: formatDate
})
},
- insertImage() {
- uni.chooseImage({
- count: 1,
- success: (res) => {
- this.editorCtx.insertImage({
- src: res.tempFilePaths[0],
- alt: '图像',
- success: function() {
- console.log('insert image success')
- }
- })
- }
- })
+ insertImage(image){
+ this.editorCtx.insertImage({
+ src:image,
+ alt: '图像',
+ success: function() {
+ console.log('insert image success')
+ }
+ })
+ },
+ chooseInsertImage() {
+ uni.chooseImage({
+ count: 1,
+ success: (res) => {
+ this.insertImage(res.tempFilePaths[0])
+ }
+ })
}
}
}
@@ -201,17 +253,18 @@
}
.editor-wrapper {
- height: calc(100vh - var(--window-top) - var(--status-bar-height) - 80px - 46px);
+ height: calc(100vh - var(--window-top) - var(--status-bar-height) - 140px - 46px);
background: #fff;
}
.iconfont {
display: inline-block;
- padding: 8px 8px;
width: 30px;
height: 30px;
cursor: pointer;
font-size: 20px;
+ margin: 0px 6px;
+ align-content: center;
}
.toolbar {
@@ -220,7 +273,8 @@
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
flex-direction: row;
flex-wrap: wrap;
- height: 110px;
+ height: 140px;
+ padding-left: 10px;
}
.ql-container {
diff --git a/pages/component/general-event/transition-event.uvue b/pages/component/general-event/transition-event.uvue
index 987a2cf5d58c0f329f4488dd1763daf3842fa07e..206120c7bd7f60dbcc783575c3913a48ad94fdc6 100644
--- a/pages/component/general-event/transition-event.uvue
+++ b/pages/component/general-event/transition-event.uvue
@@ -1,6 +1,6 @@
-
+
对图片设置transform进行旋转,在旋转完成的transitionend事件后,继续旋转
@@ -18,9 +18,24 @@
element: null as UniElement | null,
isStart: false,
buttonValue: "开启图片旋转",
- onTransitionEndTriggr: false
+ onTransitionEndTriggr: false,
+ isShow: false
}
},
+ onReady() {
+ // #ifdef APP-ANDROID
+ var that = this
+ class ThreadRunnable extends Runnable {
+ override run() {
+ that.isShow = true
+ }
+ }
+ new Thread(new ThreadRunnable()).start()
+ // #endif
+ // #ifndef APP-ANDROID
+ this.isShow = true
+ // #endif
+ },
methods: {
switchBtn() {
if (!this.isStart) {
@@ -53,17 +68,18 @@
diff --git a/pages/component/label/label.test.js b/pages/component/label/label.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a102454f7dec711c634347152f98adbd6d2141d1
--- /dev/null
+++ b/pages/component/label/label.test.js
@@ -0,0 +1,44 @@
+let page;
+describe('label.uvue', () => {
+ console.log(process.env.uniTestPlatformInfo,process.env.uniTestPlatformInfo.startsWith('web'))
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/component/label/label')
+ await page.waitFor('view');
+ });
+ afterEach(async() => {
+ await page.setData({
+ checkboxValue: [],
+ radioValue:''
+ })
+ });
+ function getData(key = '') {
+ return new Promise(async (resolve, reject) => {
+ const data = await page.data()
+ resolve(key ? data[key] : data)
+ })
+ }
+ it('表单组件在label内', async () => {
+ expect(await getData('checkboxValue')).toEqual([])
+ const checkboxItems = await page.$$('.checkboxItemsTest')
+ await checkboxItems[0].tap()
+ expect(await getData('checkboxValue')).toEqual(['USA', 'CHN'])
+ })
+ it('label用for标识表单组件', async () => {
+ const radioItems = await page.$$('.label-2-text')
+ await radioItems[0].tap()
+ expect(await getData('radioValue')).toEqual('USA')
+ await radioItems[1].tap()
+ expect(await getData('radioValue')).toEqual('CHN')
+ })
+ it('label内有多个时选中第一个', async () => {
+ const labelText = await page.$('.uni-center')
+ await labelText.tap()
+ expect(await getData('checkboxValue')).toEqual([''])
+ })
+})
diff --git a/pages/component/label/label.uvue b/pages/component/label/label.uvue
index 89cb49f851253a165e67e17c60bf1025f309bacb..d236ba0a6a19c2bf0de5e6efe494ccc9ddd8f620 100644
--- a/pages/component/label/label.uvue
+++ b/pages/component/label/label.uvue
@@ -5,7 +5,7 @@
表单组件在label内
-
-
- {{array[index].name}}
+
+ {{array[index].name}}
@@ -22,8 +22,8 @@
当前选择
-
- {{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}}
+
+ {{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}}
@@ -36,7 +36,7 @@
当前选择
-
+
{{time}}
@@ -53,7 +53,7 @@
当前选择
-
+
{{date}}
diff --git a/pages/component/textarea/textarea.uvue b/pages/component/textarea/textarea.uvue
index da1b1ad451fff804e044ab5da87c663b14a500b2..8b4e0862200d76e529d142382a4455f443af8015 100644
--- a/pages/component/textarea/textarea.uvue
+++ b/pages/component/textarea/textarea.uvue
@@ -33,7 +33,7 @@ export default {
textarea_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
textarea_confirm() { console.log("点击完成时, 触发 confirm 事件,event.detail = {value: value}") },
textarea_input() { console.log("当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上") },
- textarea_linechange(e) { console.log(e,"输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}") },
+ textarea_linechange() { console.log("输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}") },
textarea_blur() { console.log("输入框失去焦点时触发,event.detail = {value, cursor}") },
textarea_keyboardheightchange() { console.log("键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}") },
textarea_focus() { console.log("输入框聚焦时触发,event.detail = { value, height },height 为键盘高度") },
diff --git a/pages/component/video/video.uvue b/pages/component/video/video.uvue
index fee0c513bdf18d5b2d8f5ac14068ceeb04e8fa0d..e61144ea12e850bcd19adf20c0beda9e33490a62 100644
--- a/pages/component/video/video.uvue
+++ b/pages/component/video/video.uvue
@@ -12,6 +12,7 @@
@fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
+
@@ -178,7 +179,7 @@
danmuBtn: false,
enableDanmu: true,
pageGesture: false,
- direction: -90,
+ direction: -1,
_direction: 0,
requestFullScreenOptions: {
direction: -90
@@ -412,6 +413,9 @@
onControlsToggle: function (res : UniVideoControlsToggleEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
},
+ onSrcInputConfirm(event : UniInputConfirmEvent) {
+ this.src = event.detail.value;
+ },
// 自动化测试
downloadSource() {
uni.downloadFile({
@@ -434,4 +438,10 @@
width: 100%;
height: 200px;
}
+
+ .input {
+ height: 40px;
+ background: #FFF;
+ margin: 5px 0;
+ }
diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue
index c4bd240c5a529762eec1c4091b5eeeb5d92eed86..d27fb4a2df2969882ba64b1d18bd95dee92ecf78 100644
--- a/pages/tabBar/API.uvue
+++ b/pages/tabBar/API.uvue
@@ -85,15 +85,17 @@
name: '获取启动参数',
url: 'get-launch-options-sync',
},
+ // #ifndef WEB
+ {
+ name: 'env环境变量',
+ url: 'env'
+ },
+ // #endif
// #ifdef APP-ANDROID
{
name: '退出应用',
url: 'exit',
- },
- {
- name: 'env',
- url: 'env'
- },
+ }
// #endif
] as Page[],
},
@@ -170,12 +172,10 @@
api: ["Element.takeSnapshot"]
},
// #endif
- // #ifdef APP-ANDROID || WEB
{
name: 'element大小变化监听',
url: 'resize-observer'
},
- // #endif
{
name: 'node节点',
url: 'nodes-info',
@@ -280,12 +280,12 @@
name: '安装Apk',
url: 'install-apk'
},
- // #endif
- // #ifdef WEB
- {
- name: "打电话",
- url: "make-phone-call",
- },
+ // #endif
+ // #ifdef WEB
+ {
+ name: "打电话",
+ url: "make-phone-call",
+ },
// #endif
/*
{
@@ -390,12 +390,12 @@
name: "压缩视频",
url: 'compress-video'
},
- // #endif
- // #ifdef WEB
- {
- name: "音频",
- url: "inner-audio",
- },
+ // #endif
+ // #ifdef WEB
+ {
+ name: "音频",
+ url: "inner-audio",
+ },
// #endif
/*
{
@@ -420,12 +420,12 @@
{
name: '获取当前位置',
url: 'get-location',
- },
- // #ifdef WEB
- {
- name: "地图控制",
- url: "map",
- },
+ },
+ // #ifdef WEB
+ {
+ name: "地图控制",
+ url: "map",
+ },
// #endif
/* {
name: "使用地图查看位置",
@@ -546,16 +546,16 @@
}
] as Page[]
},
- {
- id: 'theme-change',
- name: '主题切换',
- pages: [
- {
- name: '主题切换',
- url: 'theme-change',
- }
- ] as Page[]
- },
+ // {
+ // id: 'theme-change',
+ // name: '主题切换',
+ // pages: [
+ // {
+ // name: '主题切换',
+ // url: 'theme-change',
+ // }
+ // ] as Page[]
+ // },
// #endif
/*
{
diff --git a/pages/tabBar/template.uvue b/pages/tabBar/template.uvue
index 7c66fb5718ed1d2366584a4470d946b641f11b0c..017ceb37b989971086f65d7b1e79f7726c1bc0b4 100644
--- a/pages/tabBar/template.uvue
+++ b/pages/tabBar/template.uvue
@@ -184,16 +184,16 @@
open: false,
pages: [] as Page[],
},
+ // #endif
{
id: 'schema',
url: 'schema',
name: '打开外部链接',
open: false,
pages: [] as Page[],
- }
- // #endif
+ },
// #ifdef APP-ANDROID
- ,{
+ {
id: 'share',
url: 'share',
name: '分享示例',
diff --git a/pages/template/navbar-lite/navbar-lite.uvue b/pages/template/navbar-lite/navbar-lite.uvue
index 1b06e34aa8b04f88e70905ca5de773b4af281869..10bb859c5bd3e2a446dfaad79b6295e9657f2eec 100644
--- a/pages/template/navbar-lite/navbar-lite.uvue
+++ b/pages/template/navbar-lite/navbar-lite.uvue
@@ -37,7 +37,7 @@
-
+
diff --git a/pages/template/schema/schema.uvue b/pages/template/schema/schema.uvue
index 9ff5aaea52cbcb141c732afc177ee600275e9be5..9e0b05fe796ab23a98ac4abf05c2a1f8c92603b4 100644
--- a/pages/template/schema/schema.uvue
+++ b/pages/template/schema/schema.uvue
@@ -1,6 +1,8 @@
+
+
@@ -23,4 +32,12 @@ import { openSchema } from '@/uni_modules/uts-openSchema'
.button {
margin: 15px;
}
+ .tip {
+ padding: 8px;
+ }
+ .link {
+ color: #7A7E83;
+ font-size: 14px;
+ line-height: 20px;
+ }
diff --git a/static/fonts/icon-star.ttf b/static/fonts/icon-star.ttf
index a71175d47be0f4eb0421b4be5d00226bf654f06a..8e199387b3e4f0c2b42c1e3b8845ae093cbf806a 100644
Binary files a/static/fonts/icon-star.ttf and b/static/fonts/icon-star.ttf differ
diff --git a/uni_modules/uts-openSchema/utssdk/web/index.uts b/uni_modules/uts-openSchema/utssdk/web/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e74c53cee9b797bc5020e6cd5ba0b67c5c796acd
--- /dev/null
+++ b/uni_modules/uts-openSchema/utssdk/web/index.uts
@@ -0,0 +1,5 @@
+import { OpenSchema } from '../interface.uts'
+
+export const openSchema: OpenSchema = function(url: string): void {
+ location.href = url;
+}