diff --git a/pages.json b/pages.json index 86e6780769f17087d6092680937da01868909bba..ddaad60e032b36c67c58200d12a29f90999a26be 100644 --- a/pages.json +++ b/pages.json @@ -618,6 +618,54 @@ "navigationBarTitleText": "图片" } }, + // #ifdef APP-ANDROID + { + "path" : "pages/API/get-image-info/get-image-info", + "style" : + { + "navigationBarTitleText" : "获取图片信息" + } + }, + { + "path" : "pages/API/compress-image/compress-image", + "style" : + { + "navigationBarTitleText" : "压缩图片" + } + }, + // #endif + // #ifdef APP + // { + // "path" : "pages/API/choose-video/choose-video", + // "style" : + // { + // "navigationBarTitleText" : "拍摄视频或从相册中选择视频" + // } + // }, + { + "path" : "pages/API/save-video-to-photos-album/save-video-to-photos-album", + "style" : + { + "navigationBarTitleText" : "保存视频到相册" + } + }, + // #endif + // #ifdef APP-ANDROID + { + "path" : "pages/API/get-video-info/get-video-info", + "style" : + { + "navigationBarTitleText" : "获取视频信息" + } + }, + // { + // "path" : "pages/API/compress-video/compress-video", + // "style" : + // { + // "navigationBarTitleText" : "压缩视频" + // } + // }, + // #endif { "path": "pages/API/get-network-type/get-network-type", "style": { @@ -1236,6 +1284,7 @@ "navigationBarTitleText": "nested-scroll-body" } }, + // #ifdef APP || WEB { "path": "pages/API/request-payment/request-payment", "style": { @@ -1280,6 +1329,7 @@ "backgroundColor": "#F8F8F8" } }, + // #endif { "path" : "pages/template/custom-long-list/custom-long-list", "style" : { @@ -1302,13 +1352,13 @@ "navigationBarTitleText" : "", "backgroundColorContent": "#fffae8" } - } - // #ifdef APP-ANDROID - ,{ + }, + // #ifdef APP-ANDROID || WEB + { "path" : "pages/API/resize-observer/resize-observer", "style" : { - "navigationBarTitleText" : "resize0bserver" + "navigationBarTitleText" : "resize observer" } }, // #endif diff --git a/pages/API/compress-image/compress-image.uvue b/pages/API/compress-image/compress-image.uvue new file mode 100644 index 0000000000000000000000000000000000000000..3092d6880ec32167551dc5f4fcba49f0ef6f648f --- /dev/null +++ b/pages/API/compress-image/compress-image.uvue @@ -0,0 +1,134 @@ + + + + + diff --git a/pages/API/get-app-base-info/get-app-base-info.test.js b/pages/API/get-app-base-info/get-app-base-info.test.js index 2a446c6c7fe8ecf3dbe181209e92affe2b98c68d..a47c21f65fe31c30429f3d7379415c9ca499e4fb 100644 --- a/pages/API/get-app-base-info/get-app-base-info.test.js +++ b/pages/API/get-app-base-info/get-app-base-info.test.js @@ -10,6 +10,16 @@ describe('ExtApi-GetAppBaseInfo', () => { ] const numberProperties = [ 'uniCompilerVersionCode', 'uniRuntimeVersionCode' + ] + const booleanProperties = [ + 'isUniAppX' + ] + const requiredProperties = [ + 'uniCompilerVersion', + 'uniCompilerVersionCode', + 'uniRuntimeVersion', + 'uniRuntimeVersionCode', + 'isUniAppX' ] beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) @@ -28,6 +38,16 @@ describe('ExtApi-GetAppBaseInfo', () => { expect(value).not.toBeNull(); expect(value).toBeGreaterThanOrEqual(3.90); } + if (booleanProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); + expect(typeof value).toBe('boolean'); + } } - }); + }); + 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/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js index 31a6c0a35ec851844b74daff8274adfd66fba11d..a8cbee3a3949d3220440cc022d9a1c4bce60a1bc 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -38,8 +38,11 @@ describe('getCurrentPages', () => { await page.callMethod('getPageStyle') await page.waitFor(200) - const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh + const data2 = await page.data() + const isEnablePullDownRefresh2 = data2.currentPageStyle.enablePullDownRefresh + const currentPageStyleIsUTSJSONObject2 = data2.currentPageStyleIsUTSJSONObject expect(isEnablePullDownRefresh2).toBe(false) + expect(currentPageStyleIsUTSJSONObject2).toBe(true) await page.callMethod('startPullDownRefresh') await page.waitFor(500) diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue index 7a816e0d5e742164a927b4d1b98e34e70bc12859..a0c61895f943bd3a93b1661f914165a9a698eb8c 100644 --- a/pages/API/get-current-pages/get-current-pages.uvue +++ b/pages/API/get-current-pages/get-current-pages.uvue @@ -33,6 +33,7 @@ checked: false, pages: [] as Page[], currentPageStyle: {} as UTSJSONObject, + currentPageStyleIsUTSJSONObject: true, // TODO enablePullDownRefreshStatus: true } @@ -65,7 +66,8 @@ getPageStyle() { const pages = getCurrentPages(); const currentPage = pages[pages.length - 1]; - this.currentPageStyle = currentPage.$getPageStyle(); + this.currentPageStyle = currentPage.$getPageStyle(); + this.currentPageStyleIsUTSJSONObject = this.currentPageStyle instanceof UTSJSONObject }, setPageStyle(enable : boolean) { // 目前仅支持 enablePullDownRefresh diff --git a/pages/API/get-image-info/get-image-info.uvue b/pages/API/get-image-info/get-image-info.uvue new file mode 100644 index 0000000000000000000000000000000000000000..152bbd94f34df9025c34a13260283bae8a8787dd --- /dev/null +++ b/pages/API/get-image-info/get-image-info.uvue @@ -0,0 +1,85 @@ + + + + + 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 6f117c57e3d0dc4818a5ffe7ce31f36db31267a8..888aa8cdff3d1cc7987097cecb9effa1936be07d 100644 --- a/pages/API/get-system-info/get-system-info.test.js +++ b/pages/API/get-system-info/get-system-info.test.js @@ -15,6 +15,16 @@ describe('ExtApi-GetSystemInfo', () => { 'windowWidth', 'windowHeight', 'windowTop', 'windowBottom', 'screenTop', 'uniCompilerVersionCode', 'uniRuntimeVersionCode' + ] + const booleanProperties = [ + 'isUniAppX' + ] + const requiredProperties = [ + 'uniCompilerVersion', + 'uniCompilerVersionCode', + 'uniRuntimeVersion', + 'uniRuntimeVersionCode', + 'isUniAppX' ] beforeAll(async () => { @@ -34,6 +44,10 @@ describe('ExtApi-GetSystemInfo', () => { expect(value).not.toBeNull(); 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); } @@ -41,5 +55,11 @@ describe('ExtApi-GetSystemInfo', () => { expect(['light', 'dark']).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/get-video-info/get-video-info.uvue b/pages/API/get-video-info/get-video-info.uvue new file mode 100644 index 0000000000000000000000000000000000000000..18095fa9b99cd0d283be6ddafe83ab735ffc5822 --- /dev/null +++ b/pages/API/get-video-info/get-video-info.uvue @@ -0,0 +1,57 @@ + + + + + diff --git a/pages/API/resize-observer/resize-observer.test.js b/pages/API/resize-observer/resize-observer.test.js index fb854f890a13ec371d0bd207a544ee235a3eefed..22160835196358c0332b10f71d7863294c9283e4 100644 --- a/pages/API/resize-observer/resize-observer.test.js +++ b/pages/API/resize-observer/resize-observer.test.js @@ -1,5 +1,8 @@ describe('api-resize-observer', () => { - if (!process.env.uniTestPlatformInfo.startsWith('android')) { + if ( + !process.env.uniTestPlatformInfo.startsWith('android') && + !process.env.uniTestPlatformInfo.startsWith('web') + ) { it('dummyTest', async () => { expect(1).toBe(1) }) diff --git a/pages/API/resize-observer/resize-observer.uvue b/pages/API/resize-observer/resize-observer.uvue index a03e7e32dd1d6a9be0f8c37286e9688aeb267615..d2377add5f940a4bcfabd86e00dacaefc8f84f28 100644 --- a/pages/API/resize-observer/resize-observer.uvue +++ b/pages/API/resize-observer/resize-observer.uvue @@ -70,14 +70,14 @@ methods: { innerBoxClick() { if (this.innerBoxElement != null) { - this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset) - this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset) + this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset + 'px') + this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset + 'px') } }, outBoxClick() { if (this.outBoxElement != null) { - this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset) - this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset) + this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset + 'px') + this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset + 'px') } }, revertBoxSize() { diff --git a/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue b/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue index 7e980e07f8b13e2a965483646c872e73b0a1bee3..69321ff1b08aa6f7921672a47a021cd149c97b60 100644 --- a/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue +++ b/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue @@ -2,8 +2,11 @@ - - + + + + + @@ -13,6 +16,7 @@ export default { data() { return { + title: "saveImageToPhotosAlbum" } }, methods: { @@ -39,4 +43,13 @@ diff --git a/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue b/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue new file mode 100644 index 0000000000000000000000000000000000000000..8bc25ff5864cfc4b2bf476b4c9b10b2c519d6bd8 --- /dev/null +++ b/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue @@ -0,0 +1,67 @@ + + + + + diff --git a/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js b/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js index 74a4c5f6f2af0700a5590befb68af464e7587ca5..6a33bdda881a805964e45a4aee230b2afa88b9cb 100644 --- a/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js +++ b/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js @@ -7,7 +7,12 @@ describe('set-page-backgroundColorContent', () => { it('check_backgroundColorContent_red', async () => { await page.callMethod('changeColor', "") - page.waitFor(100) + page.waitFor(200) + + const color = (await page.data()).currentBackgroundColorContent + expect(color).toBe("red") + + const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); }) diff --git a/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue b/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue index a04d25ebe4a8f5d98f7386df7f077349f1608e91..cde1911fd7ddf06bd739c98a4603b51a59846c99 100644 --- a/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue +++ b/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue @@ -8,7 +8,8 @@ export default { data() { return { - isChange : false + isChange : false, + currentBackgroundColorContent: "" as any | null } }, methods: { @@ -17,6 +18,9 @@ let page = pages[pages.length - 1] page.$setPageStyle({"backgroundColorContent" : this.isChange ? "" : "red"}) this.isChange = !this.isChange + + let pageJson = page.$getPageStyle() + this.currentBackgroundColorContent = pageJson["backgroundColorContent"] } } } diff --git a/pages/API/unicloud-database/unicloud-database.test.js b/pages/API/unicloud-database/unicloud-database.test.js index 80855554214ae8f9c53506ab411ba8ddcbe35334..cec19a63b982c7d2461344fa0bb682f917934fb4 100644 --- a/pages/API/unicloud-database/unicloud-database.test.js +++ b/pages/API/unicloud-database/unicloud-database.test.js @@ -17,6 +17,7 @@ describe('unicloud-database', () => { await page.callMethod('dbGetWithCommand') await page.callMethod('dbUpdate') await page.callMethod('dbRemove') + await page.callMethod('dbMultiSend') const { addId, @@ -26,6 +27,7 @@ describe('unicloud-database', () => { getData, getWithCommandData, removeDeleted, + multiSendSuccessCount, } = await page.data() expect(addId !== '').toBe(true) @@ -35,6 +37,7 @@ describe('unicloud-database', () => { expect(getWithCommandData.length).toBe(1) expect(updateUpdated).toBe(3) expect(removeDeleted).toBe(3) + expect(multiSendSuccessCount).toBe(2) }) diff --git a/pages/API/unicloud-database/unicloud-database.uvue b/pages/API/unicloud-database/unicloud-database.uvue index aeb650c1553e4a9dc95de3202d4ca9f811cfecfc..36cb30f452d0f61bbcd12299533ed0dc2c985a10 100644 --- a/pages/API/unicloud-database/unicloud-database.uvue +++ b/pages/API/unicloud-database/unicloud-database.uvue @@ -14,6 +14,7 @@ + @@ -35,6 +36,7 @@ getWithCommandData: [] as Array, removeDeleted: 0, lookupData: [] as Array, + multiSendSuccessCount: 0, isUniTest: false } }, @@ -278,6 +280,39 @@ const error = err as UniCloudError this.notify(error.errMsg, '错误') }) + }, + dbMultiSend() { + const db = uniCloud.databaseForJQL() + const temp1 = db.collection('type') + .where( + 'tag == "default-tag"' + ).getTemp() + const temp2 = db.collection('type') + .where( + 'tag == "default-tag"' + ).getTemp() + db.multiSend(temp1, temp2) + .then(res => { + uni.hideLoading() + let successCount = 0 + for (let i = 0; i < res.dataList.length; i++) { + const item = res.dataList[i] + if(item.errCode == 0) { + console.log(`第${i}个请求查询到${item.data!.length}条数据`) + successCount++ + } else { + console.error(`第${i}个请求查询失败,错误信息:${item.data!.length}`) + } + } + this.multiSendSuccessCount = successCount + this.notify(`合并查询成功,成功查询的语句条数为:${successCount}`, '提示') + }) + .catch((err : any | null) => { + uni.hideLoading() + const error = err as UniCloudError + console.error(err) + this.notify(error.errMsg, '错误') + }) } } } diff --git a/pages/CSS/transform/translate.uvue b/pages/CSS/transform/translate.uvue index 8f08abd8ded1302848ee91b389944502b04925dd..c9031cd15de58c869f2da9412d8e587113e25c86 100644 --- a/pages/CSS/transform/translate.uvue +++ b/pages/CSS/transform/translate.uvue @@ -10,7 +10,7 @@ 转变前位置 - translate(-50%, 50%) + translate(-50%,50%) 转变前位置 diff --git a/pages/component/list-view/list-view-multiplex.uvue b/pages/component/list-view/list-view-multiplex.uvue index 7467e010859a934432e43611af6262d48fd44473..951d0021102eec6ce5ec53c5d02056a64b49796f 100644 --- a/pages/component/list-view/list-view-multiplex.uvue +++ b/pages/component/list-view/list-view-multiplex.uvue @@ -7,7 +7,7 @@ item-------{{index}} - item-------{{index}} + item-------{{index}} diff --git a/pages/component/sticky-header/sticky-header.uvue b/pages/component/sticky-header/sticky-header.uvue index f6a06496d18e82c084d68d05671692e554c9e77c..baca9ef78df3c83e1009ae4a6e321118ccee77bc 100644 --- a/pages/component/sticky-header/sticky-header.uvue +++ b/pages/component/sticky-header/sticky-header.uvue @@ -3,7 +3,7 @@ :refresher-enabled="refresher_enabled_boolean" :refresher-triggered="refresher_triggered_boolean" @refresherrefresh="list_view_refresherrefresh"> - + {{i}} diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index 2e2d47be5a3505aa723444675a53f890478b7c33..8f836a43707938fcd7cde03fe3ffa1603d990020 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -6,7 +6,8 @@ describe('component-native-sticky-section', () => { }) //检测吸顶上推效果 - it('check_sticky_section', async () => { + it('check_sticky_section', async () => { + page.waitFor(300) await page.callMethod('listViewScrollByY', 1000) const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); diff --git a/pages/component/sticky-section/sticky-section.uvue b/pages/component/sticky-section/sticky-section.uvue index 349d6cc23c4c9e337bf2a820bf35c510cc971e93..c882f4011a68a335be74b206d69abe216ee41191 100644 --- a/pages/component/sticky-section/sticky-section.uvue +++ b/pages/component/sticky-section/sticky-section.uvue @@ -1,12 +1,11 @@