From 5fbfda0dbbc76ef41f9b7f03fc50ad227e39914d Mon Sep 17 00:00:00 2001 From: shutao Date: Thu, 23 May 2024 16:57:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85theme-change=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 14 +- pages/API/theme-change/theme-change.test.js | 27 ++++ pages/API/theme-change/theme-change.uvue | 171 +++++++++++--------- pages/tabBar/API.uvue | 20 +-- 4 files changed, 139 insertions(+), 93 deletions(-) create mode 100644 pages/API/theme-change/theme-change.test.js diff --git a/pages.json b/pages.json index dcfce5fe..aa2cfba8 100644 --- a/pages.json +++ b/pages.json @@ -1309,6 +1309,13 @@ "navigationBarTitleText": "日历" } }, + { + "path": "pages/API/theme-change/theme-change", + "style": { + "navigationBarTitleText": "主题切换", + "enablePullDownRefresh": false + } + }, // #endif { "path": "pages/template/schema/schema", @@ -1380,13 +1387,6 @@ "enablePullDownRefresh": false } }, - // { - // "path": "pages/API/theme-change/theme-change", - // "style": { - // "navigationBarTitleText": "主题切换", - // "enablePullDownRefresh": false - // } - // }, { "path": "uni_modules/uni-pay-x/pages/success/success", "style": { diff --git a/pages/API/theme-change/theme-change.test.js b/pages/API/theme-change/theme-change.test.js new file mode 100644 index 00000000..0dcdb3a3 --- /dev/null +++ b/pages/API/theme-change/theme-change.test.js @@ -0,0 +1,27 @@ +// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('API-theme-change', () => { + + let page; + const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios"; + + if (!isApp) { + it('dummyTest', () => { + expect(1).toBe(1) + }) + return + } + + beforeAll(async () => { + page = await program.reLaunch('/pages/API/theme-change/theme-change') + await page.waitFor(600); + }); + + + + it("check-set-app-theme", async () => { + await page.callMethod('setAppTheme', "dark") + await page.waitFor(300) + expect(await page.data('appTheme')).toBe("dark") + }) +}); diff --git a/pages/API/theme-change/theme-change.uvue b/pages/API/theme-change/theme-change.uvue index 4afff9df..ab118218 100644 --- a/pages/API/theme-change/theme-change.uvue +++ b/pages/API/theme-change/theme-change.uvue @@ -1,81 +1,100 @@ -