提交 49d82959 编写于 作者: shutao-dc's avatar shutao-dc

update theme-change.uvue 新增原始主题用于测试还原主题样式

上级 fcc62a75
...@@ -27,11 +27,13 @@ describe('API-theme-change', () => { ...@@ -27,11 +27,13 @@ describe('API-theme-change', () => {
it("check-set-app-theme", async () => { it("check-set-app-theme", async () => {
const originalTheme = await page.data('originalTheme')
console.log("originalTheme是", originalTheme)
await page.callMethod('setAppTheme', "dark") await page.callMethod('setAppTheme', "dark")
await page.waitFor(300) await page.waitFor(300)
expect(await page.data('appTheme')).toBe("dark") expect(await page.data('appTheme')).toBe("dark")
//还原主题为light //还原主题为light
await page.callMethod('setAppTheme', "light") await page.callMethod('setAppTheme', originalTheme)
await page.waitFor(600) await page.waitFor(600)
}) })
}); });
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
appThemeChangeId: 0, appThemeChangeId: 0,
osTheme: "light" as string, osTheme: "light" as string,
appTheme: "light" as string, appTheme: "light" as string,
originalTheme: "light" as string,
current: 0, current: 0,
items: [ items: [
"light", "light",
...@@ -80,6 +81,7 @@ ...@@ -80,6 +81,7 @@
uni.getSystemInfo({ uni.getSystemInfo({
success: (res:GetSystemInfoResult) => { success: (res:GetSystemInfoResult) => {
this.osTheme = res.osTheme! this.osTheme = res.osTheme!
this.originalTheme = res.appTheme!
this.appTheme = res.appTheme == "auto" ? res.osTheme! : res.appTheme! this.appTheme = res.appTheme == "auto" ? res.osTheme! : res.appTheme!
this.current = this.items.indexOf(res.appTheme!) this.current = this.items.indexOf(res.appTheme!)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册