diff --git a/pages.json b/pages.json index 7262c24dd6c1e37766b2133b0ce2b90bda52b5b3..9685160d42710a8ec87648bcd861da6054b2120e 100644 --- a/pages.json +++ b/pages.json @@ -361,7 +361,8 @@ { "path": "pages/API/get-current-pages/get-current-pages", "style": { - "navigationBarTitleText": "getCurrentPages" + "navigationBarTitleText": "getCurrentPages", + "enablePullDownRefresh": 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 63e5a5287e4ce4efa172f5ca71f9f1347f8aec3a..1f3a26bb6ac88556874c30fbe4008b4ce33fa4e7 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -1,27 +1,53 @@ -const HOME_PAGE_PATH = '/pages/tabBar/component' -const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages' - -describe('getCurrentPages', () => { - let page - it('getCurrentPages', async () => { - // web 端等待应用首页加载完成 - if (process.env.uniTestPlatformInfo.startsWith('web')) { - const waitTime = process.env.uniTestPlatformInfo.includes('safari') - ? 5000 - : 1000 - await new Promise((resolve) => { - setTimeout(() => { - resolve() - }, waitTime) - }) - } - page = await program.switchTab(HOME_PAGE_PATH) - await page.waitFor(1000) - page = await program.navigateTo(PAGE_PATH) - await page.waitFor(1000) - await page.callMethod('_getCurrentPages') - await page.waitFor(200) - const data = await page.data() - expect(data.checked).toBe(true) - }) +const HOME_PAGE_PATH = '/pages/tabBar/component' +const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages' + +describe('getCurrentPages', () => { + let page + it('getCurrentPages', async () => { + // web 端等待应用首页加载完成 + if (process.env.uniTestPlatformInfo.startsWith('web')) { + const waitTime = process.env.uniTestPlatformInfo.includes('safari') ? + 5000 : + 1000 + await new Promise((resolve) => { + setTimeout(() => { + resolve() + }, waitTime) + }) + } + page = await program.switchTab(HOME_PAGE_PATH) + await page.waitFor(1000) + page = await program.navigateTo(PAGE_PATH) + await page.waitFor(1000) + await page.callMethod('_getCurrentPages') + await page.waitFor(200) + const data = await page.data() + expect(data.checked).toBe(true) + }) + it('getPageStyle', async () => { + await changeData(page) + + const btn = await page.$('.btn-get-page-style') + await btn.tap() + await page.waitFor(100) + + const { + currentPageStyle + } = await page.data() + + expect(currentPageStyle['enablePullDownRefresh']).toBe(true) + }) + it('setPageStyle', async () => { + await changeData(page) + + const btn = await page.$('.btn-set-page-style-0') + await btn.tap() + await page.waitFor(100) + + const { + currentPageStyle + } = await page.data() + + expect(currentPageStyle['enablePullDownRefresh']).toBe(false) + }) }) diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue index 30b63049a8b0313ab0aefeaec553de9245e61bec..95c8bcd032e5653ed4031e1e2cae71153a1284f1 100644 --- a/pages/API/get-current-pages/get-current-pages.uvue +++ b/pages/API/get-current-pages/get-current-pages.uvue @@ -1,44 +1,99 @@ - - - + + + + + +