From 367bafe82ad0243013d92dc27e17a39d23b554e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Fri, 10 May 2024 13:28:51 +0800 Subject: [PATCH] =?UTF-8?q?test:=20$getPageStyle=E5=BA=94=E8=BF=94?= =?UTF-8?q?=E5=9B=9EUTSJSONObject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/get-current-pages/get-current-pages.test.js | 5 ++++- pages/API/get-current-pages/get-current-pages.uvue | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) 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 31a6c0a3..a8cbee3a 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 7a816e0d..a0c61895 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 -- GitLab