diff --git a/pages.json b/pages.json index 58b26c60d764ec01c029d379594a7f810519af72..dab0a970fb681982065ae05f1757a66dfcbfbb44 100644 --- a/pages.json +++ b/pages.json @@ -243,6 +243,13 @@ "navigationBarTitleText": "设置导航条颜色" } }, + { + "path": "pages/API/set-navigation-bar-color/set-custom-navigation-bar-color", + "style": { + "navigationBarTitleText": "设置自定义导航栏颜色", + "navigationStyle": "custom" + } + }, { "path": "pages/API/navigator/new-page/new-page-1", "style": { @@ -335,48 +342,48 @@ "style": { "navigationBarTitleText": "background-image" } - }, - { - "path": "pages/CSS/border/border-bottom", - "style": { - "navigationBarTitleText": "border-bottom" - } + }, + { + "path": "pages/CSS/border/border-bottom", + "style": { + "navigationBarTitleText": "border-bottom" + } }, { "path": "pages/CSS/border/border-color", "style": { "navigationBarTitleText": "border-color" } - }, - { - "path": "pages/CSS/border/border-left", - "style": { - "navigationBarTitleText": "border-left" - } + }, + { + "path": "pages/CSS/border/border-left", + "style": { + "navigationBarTitleText": "border-left" + } }, { "path": "pages/CSS/border/border-radius", "style": { "navigationBarTitleText": "border-radius" } - }, - { - "path": "pages/CSS/border/border-right", - "style": { - "navigationBarTitleText": "border-right" - } + }, + { + "path": "pages/CSS/border/border-right", + "style": { + "navigationBarTitleText": "border-right" + } }, { "path": "pages/CSS/border/border-style", "style": { "navigationBarTitleText": "border-style" } - }, - { - "path": "pages/CSS/border/border-top", - "style": { - "navigationBarTitleText": "border-top" - } + }, + { + "path": "pages/CSS/border/border-top", + "style": { + "navigationBarTitleText": "border-top" + } }, { "path": "pages/CSS/border/border-width", @@ -901,30 +908,33 @@ "style": { "navigationStyle": "custom" } - }, { + }, + { "path": "pages/API/unicloud-file-api/unicloud-file-api", "style": { "navigationBarTitleText": "" } - - }, { + }, + { "path": "pages/API/unicloud-database/unicloud-database", "style": { "navigationBarTitleText": "" } - - }, { + }, + { "path": "pages/template/navbar-lite/navbar-lite", "style": { "navigationBarTitleText": "自定义导航栏", "navigationStyle": "custom" } - }, { + }, + { "path": "pages/template/custom-tab-bar/custom-tab-bar", "style": { "navigationBarTitleText": "自定义TabBar" } - }, { + }, + { "path": "pages/template/custom-tab-bar2/custom-tab-bar2", "style": { "navigationBarTitleText": "自定义TabBar2" @@ -980,4 +990,4 @@ "query": "" //启动参数,在页面的onLoad函数里面得到 }] } -} \ No newline at end of file +} diff --git a/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6fa9e79332888d3e46d387e061c65788fcdd9afc --- /dev/null +++ b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js @@ -0,0 +1,30 @@ +const CURRENT_PAGE_PATH = + "/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color"; + +describe("setCustomNavigationBarColor", () => { + let page; + let originLifeCycleNum; + beforeAll(async () => { + page = await program.navigateTo(CURRENT_PAGE_PATH); + await page.waitFor(1000); + originLifeCycleNum = await page.callMethod("getLifeCycleNum"); + }); + + afterAll(async () => { + await page.callMethod("setLifeCycleNum", originLifeCycleNum); + const lifeCycleNum = await page.callMethod("getLifeCycleNum"); + expect(lifeCycleNum).toBe(originLifeCycleNum); + }); + + it("setNavigationBarColor2", async () => { + await page.callMethod("setNavigationBarColor2"); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }); + + it("setNavigationBarColor1", async () => { + await page.callMethod("setNavigationBarColor1"); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }); +}); diff --git a/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue new file mode 100644 index 0000000000000000000000000000000000000000..dac025f6657c59c6d8354594fe969a577324e887 --- /dev/null +++ b/pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue @@ -0,0 +1,105 @@ + + + + + diff --git a/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js b/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js index aeb3a668d28cb8b73a444b8c259c75ebd0a72291..a293b96b61498f6afbb943c7b787affcb1313045 100644 --- a/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js +++ b/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js @@ -4,7 +4,6 @@ const CURRENT_PAGE_PATH = describe('setNavigationBarColor', () => { let page let originLifeCycleNum - let lifeCycleNum beforeAll(async () => { page = await program.navigateTo(CURRENT_PAGE_PATH) await page.waitFor(1000) @@ -13,7 +12,7 @@ describe('setNavigationBarColor', () => { afterAll(async () => { await page.callMethod('setLifeCycleNum', originLifeCycleNum) - lifeCycleNum = await page.callMethod('getLifeCycleNum') + const lifeCycleNum = await page.callMethod('getLifeCycleNum') expect(lifeCycleNum).toBe(originLifeCycleNum) }) diff --git a/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue b/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue index ee5d7a76016b97528faf507a83b31e74d0c27ab6..913daf0a1c8f9c0d26cbd0c0831207abf84ae9ea 100644 --- a/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue +++ b/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue @@ -8,19 +8,17 @@ +