diff --git a/pages.json b/pages.json index 14a96dd9583bc6fc4d0588b8c592c752716b5731..80ad54f89cb164a20eb017f403edc2533a899c50 100644 --- a/pages.json +++ b/pages.json @@ -308,7 +308,7 @@ } }, { - "path": "pages/component/datacom/datacom", + "path": "pages/component/unicloud-db/unicloud-db/mixin-datacom", "style": { "navigationBarTitleText": "mixinDatacom" } @@ -431,7 +431,7 @@ } }, { - "path" : "pages/component/canvas/ball", + "path" : "pages/component/canvas/canvas/ball", "style" : { "navigationBarTitleText" : "ball" @@ -554,7 +554,7 @@ } }, { - "path": "pages/API/nodes-info/nodes-info", + "path": "pages/API/create-selector-query/create-selector-query", "style": { "navigationBarTitleText": "查询节点信息的对象" } @@ -671,15 +671,15 @@ } }, { - "path": "pages/API/unicloud/call-function", + "path": "pages/API/unicloud/unicloud/cloud-function", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "云函数" } }, { - "path": "pages/API/unicloud/import-object", + "path": "pages/API/unicloud/unicloud/cloud-object", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "云对象" } }, { @@ -806,15 +806,15 @@ } }, { - "path": "pages/API/unicloud-file-api/unicloud-file-api", + "path": "pages/API/unicloud/unicloud/cloud-storage", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "cloud storage" } }, { - "path": "pages/API/unicloud-database/unicloud-database", + "path": "pages/API/unicloud/unicloud/database", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "database" } }, { @@ -916,7 +916,7 @@ } }, { - "path" : "pages/API/inner-audio/inner-audio", + "path" : "pages/API/create-inner-audio-context/create-inner-audio-context", "style" : { "navigationBarTitleText" : "inner-audio" diff --git a/pages/API/unicloud-file-api/unicloud-file-api.uvue b/pages/API/cloud-storage/cloud-storage.uvue similarity index 100% rename from pages/API/unicloud-file-api/unicloud-file-api.uvue rename to pages/API/cloud-storage/cloud-storage.uvue diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue new file mode 100644 index 0000000000000000000000000000000000000000..1f3b7e008d072e55273f958bea07ff9729312a85 --- /dev/null +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue @@ -0,0 +1,238 @@ + + + diff --git a/pages/API/create-inner-audio-context/inner-audio-format.uvue b/pages/API/create-inner-audio-context/inner-audio-format.uvue new file mode 100644 index 0000000000000000000000000000000000000000..9eec12ab2d87765e5714e46acebbf83d37cd6014 --- /dev/null +++ b/pages/API/create-inner-audio-context/inner-audio-format.uvue @@ -0,0 +1,134 @@ + + + + + diff --git a/pages/API/create-inner-audio-context/inner-audio-path.uvue b/pages/API/create-inner-audio-context/inner-audio-path.uvue new file mode 100644 index 0000000000000000000000000000000000000000..3b9ad2ae460f1ed9f5aa75e8b974a8d932bba0a1 --- /dev/null +++ b/pages/API/create-inner-audio-context/inner-audio-path.uvue @@ -0,0 +1,99 @@ + + + + + diff --git a/pages/API/create-inner-audio-context/inner-audio.test.js b/pages/API/create-inner-audio-context/inner-audio.test.js new file mode 100644 index 0000000000000000000000000000000000000000..92389d6346fa93d5cb5e41fb87c333ac4a8fd982 --- /dev/null +++ b/pages/API/create-inner-audio-context/inner-audio.test.js @@ -0,0 +1,73 @@ +describe('inner-audio', () => { + if (!process.env.uniTestPlatformInfo.startsWith('web')) { + it('app', () => { + expect(1).toBe(1) + }) + return + } + beforeAll(async () => { + page = await program.reLaunch('/pages/API/inner-audio/inner-audio') + await page.waitFor('view'); + }); + + function getData(key = '') { + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) + } + + it('onCanplay',async()=>{ + await page.waitFor(1000) + await page.waitFor(async()=>{ + return await getData('isCanplay') + }) + expect(await getData('buffered')).toBeGreaterThan(0) + }) + + it('play-onPlay-onTimeUpdate', async () => { + await page.callMethod('play') + await page.waitFor(3000); + expect(await getData('isPlaying')).toBeTruthy() + console.log("duration:",await getData('duration'),"currentTime:",await getData('currentTime')) + expect(await getData('duration')).toBeCloseTo(175.109, 0); + // console.log("isPaused",await getData('isPaused')) + // expect(await getData('currentTime')).toBeGreaterThan(0); + // expect(await getData('isPaused')).toBeFalsy(); + }); + + it('seek-onSeeking-onSeeked', async () => { + await page.callMethod('onchange',20) + await page.waitFor(500); + expect(await getData('onSeekingTest')).toBeTruthy(); + // expect(await getData('onWaitingTest')).toBeTruthy(); + expect(await getData('onSeekedTest')).toBeTruthy(); + }); + + it('pause-onPause', async () => { + await page.callMethod('pause') + await page.waitFor(500); + expect(await getData('isPlaying')).toBeFalsy() + // expect(await getData('isPaused')).toBeTruthy(); + }); + + it('stop-onStop', async () => { + await page.callMethod('play') + await page.waitFor(2000); + // 第一次点停止时,不触发onStop事件 + await page.callMethod('stop') + await page.callMethod('stop') + await page.waitFor(1000); + expect(await getData('isPlaying')).toBeFalsy() + // expect(await getData('isPaused')).toBeTruthy(); + }); + + it('onEnded', async () => { + await page.callMethod('onchange',173) + await page.waitFor(500); + await page.callMethod('play') + await page.waitFor(3000); + // expect(await getData('isPlayEnd')).toBeTruthy(); + }); + +}); diff --git a/pages/API/nodes-info/nodes-info.uvue b/pages/API/create-selector-query/create-selector-query.uvue similarity index 100% rename from pages/API/nodes-info/nodes-info.uvue rename to pages/API/create-selector-query/create-selector-query.uvue diff --git a/pages/API/nodes-info/nodes-info-child.uvue b/pages/API/create-selector-query/nodes-info-child.uvue similarity index 100% rename from pages/API/nodes-info/nodes-info-child.uvue rename to pages/API/create-selector-query/nodes-info-child.uvue diff --git a/pages/API/nodes-info/nodes-info.test.js b/pages/API/create-selector-query/nodes-info.test.js similarity index 100% rename from pages/API/nodes-info/nodes-info.test.js rename to pages/API/create-selector-query/nodes-info.test.js diff --git a/pages/API/unicloud/call-function.test.js b/pages/API/unicloud/unicloud/call-function.test.js similarity index 100% rename from pages/API/unicloud/call-function.test.js rename to pages/API/unicloud/unicloud/call-function.test.js diff --git a/pages/API/unicloud/call-function.uvue b/pages/API/unicloud/unicloud/cloud-function.uvue similarity index 100% rename from pages/API/unicloud/call-function.uvue rename to pages/API/unicloud/unicloud/cloud-function.uvue diff --git a/pages/API/unicloud/import-object.uvue b/pages/API/unicloud/unicloud/cloud-object.uvue similarity index 100% rename from pages/API/unicloud/import-object.uvue rename to pages/API/unicloud/unicloud/cloud-object.uvue diff --git a/pages/API/unicloud/unicloud/cloud-storage.uvue b/pages/API/unicloud/unicloud/cloud-storage.uvue new file mode 100644 index 0000000000000000000000000000000000000000..d6a3218713ed138c8c7c25fa9d8beb7ea060888b --- /dev/null +++ b/pages/API/unicloud/unicloud/cloud-storage.uvue @@ -0,0 +1,92 @@ + + + + diff --git a/pages/API/unicloud/unicloud/database.uvue b/pages/API/unicloud/unicloud/database.uvue new file mode 100644 index 0000000000000000000000000000000000000000..f37730e2ee561ff5eab5fe85bc0cd33da99b4733 --- /dev/null +++ b/pages/API/unicloud/unicloud/database.uvue @@ -0,0 +1,322 @@ + + + + + diff --git a/pages/component/canvas/ball.uvue b/pages/component/canvas/canvas/ball.uvue similarity index 100% rename from pages/component/canvas/ball.uvue rename to pages/component/canvas/canvas/ball.uvue diff --git a/pages/component/unicloud-db/unicloud-db/datacom.uvue b/pages/component/unicloud-db/unicloud-db/datacom.uvue new file mode 100644 index 0000000000000000000000000000000000000000..d6392ff818fd1b864fc7f43ed35e44ff395825a0 --- /dev/null +++ b/pages/component/unicloud-db/unicloud-db/datacom.uvue @@ -0,0 +1,70 @@ + + + + + diff --git a/pages/component/unicloud-db/unicloud-db/mixin-datacom.test.js b/pages/component/unicloud-db/unicloud-db/mixin-datacom.test.js new file mode 100644 index 0000000000000000000000000000000000000000..95a8804ada679250806617dfb9791491b2a6dd74 --- /dev/null +++ b/pages/component/unicloud-db/unicloud-db/mixin-datacom.test.js @@ -0,0 +1,20 @@ +const PAGE_PATH = '/pages/component/mixin-datacom/mixin-datacom' + +describe('mixin-datacom', () => { + if (process.env.uniTestPlatformInfo.startsWith('web')) { + it('dummyTest', async () => { + expect(1).toBe(1) + }) + return + } + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500) + }) + it('mixinDatacomGet', async () => { + const datacom = await page.$('.datacom') + const children = await datacom.$$('.list-item') + expect(children.length > 0).toBe(true) + }) +}) diff --git a/pages/component/unicloud-db/unicloud-db/mixin-datacom.uvue b/pages/component/unicloud-db/unicloud-db/mixin-datacom.uvue new file mode 100644 index 0000000000000000000000000000000000000000..9f3ce40507fb2956b862afbcd1ec55b377048240 --- /dev/null +++ b/pages/component/unicloud-db/unicloud-db/mixin-datacom.uvue @@ -0,0 +1,27 @@ + + + + + diff --git a/readme.md b/readme.md index fd86721c2936afd69bd524ae299fa8374668fb76..d5fe12c7223ef7552b282ad88e1eed7a699e3719 100644 --- a/readme.md +++ b/readme.md @@ -24,13 +24,23 @@ npx husky@9.0.11 #### pages.json -创建 component、API、css 示例页面时,如果该示例页面需要在对应 tabBar 菜单中展示,命名需要遵循以下规则: +创建 component、API、css 示例页面时,如果该示例页面需要在对应 tabBar 菜单中展示,`path` 命名需要遵循以下规则: - component pages/component/component-name/component-name - API pages/API/api-name/api-name - css pages/API/css-name/css-name -增加上述示例页面时,不需要基于平台兼容性补充条件编译,代码提交后,会自动生成对应的条件编译代码,并更新 pages.json。 +所以,如果是扩展示例,比如针对 `button type 属性` 的示例,`path` 可以是: +``` +pages/component/button/button-type +``` +如果想要该示例页面在菜单中显示,则需要调整为: +``` +pages/component/button/button/type +``` + + +**注意:**增加上述示例页面时,不需要基于平台兼容性补充条件编译,代码提交后,会自动生成对应的条件编译代码,并更新 pages.json。 pages.json 中增加后,需要在 [syntaxdoc](http://git.dcloud.io/uni-app-x/syntaxdoc) 仓库的 modules.json 中维护目录信息。 -**注意:** 调整现有页面的路径或平台兼容性,或移除页面时,如果该页面设计截图对比测试,需要同时调整 pages/pages.test.js 中的页面地址。 +**注意:**调整现有页面的路径或平台兼容性,或移除页面时,如果该页面设计截图对比测试,需要同时调整 pages/pages.test.js 中的页面地址。