diff --git a/pages.json b/pages.json index bf9311b257691dc48e2a290f946bb4a0a87c03c4..213b2e9199507d8bc94b2ce2b8da147b1546c962 100644 --- a/pages.json +++ b/pages.json @@ -365,6 +365,13 @@ "enablePullDownRefresh": true } }, + { + "path": "pages/API/get-current-pages/set-page-style-disable-pull-down-refresh", + "style": { + "navigationBarTitleText": "setPageStyle pull default false", + "enablePullDownRefresh": false + } + }, { "path": "pages/API/get-launch-options-sync/get-launch-options-sync", "style": { 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 7825d152a5488b4cbb4d983299bd6f12e192ddf0..31a6c0a35ec851844b74daff8274adfd66fba11d 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -40,5 +40,18 @@ describe('getCurrentPages', () => { await page.waitFor(200) const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh expect(isEnablePullDownRefresh2).toBe(false) + + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image2 = await program.screenshot({fullPage: true}); + expect(image2).toSaveImageSnapshot(); + + await page.waitFor(3500) + await page.callMethod('setPageStyle', true) + await page.waitFor(200) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image3 = await program.screenshot({fullPage: true}); + expect(image3).toSaveImageSnapshot(); }) }) diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue index faced3e17165b8e2e30909b62d153d34c76bd815..34e3c9241f1a674803ac7ff286d06db1c0d3244b 100644 --- a/pages/API/get-current-pages/get-current-pages.uvue +++ b/pages/API/get-current-pages/get-current-pages.uvue @@ -75,7 +75,10 @@ enablePullDownRefresh: enable }); this.enablePullDownRefreshStatus = enable - }, + }, + startPullDownRefresh() { + uni.startPullDownRefresh() + } // getCurrentPage(): Page { // const pages = getCurrentPages(); // const currentPage = pages[pages.length - 1]; diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bf0ba6e3439f4e824cca1e84282698093d06ded2 --- /dev/null +++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js @@ -0,0 +1,35 @@ +const PAGE_PATH = '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh' + +describe('getCurrentPages', () => { + let page + it('page-style', async () => { + page = await program.navigateTo(PAGE_PATH) + + await page.callMethod('getPageStyle') + await page.waitFor(200) + const isEnablePullDownRefresh1 = (await page.data()).currentPageStyle.enablePullDownRefresh + expect(isEnablePullDownRefresh1).toBe(false) + + await page.callMethod('setPageStyle', true) + await page.waitFor(200) + await page.callMethod('getPageStyle') + await page.waitFor(200) + const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh + expect(isEnablePullDownRefresh2).toBe(true) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image3 = await program.screenshot({fullPage: true}); + expect(image3).toSaveImageSnapshot(); + + await page.waitFor(3500) + + // setPageStyle + await page.callMethod('setPageStyle', false) + await page.waitFor(200) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image2 = await program.screenshot({fullPage: true}); + expect(image2).toSaveImageSnapshot(); + + }) +}) diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue new file mode 100644 index 0000000000000000000000000000000000000000..84a18c03cc39397fc7945990b63751f715be8bce --- /dev/null +++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue @@ -0,0 +1,95 @@ + + + + + +