diff --git a/pages.json b/pages.json index 26865d401b9a7aa7fafb10b184b03fbd05c122de..09868bb25b1cc089d83e1db9b58704a6cbcaf139 100644 --- a/pages.json +++ b/pages.json @@ -257,11 +257,17 @@ "navigationBarTitleText": "页面跳转" } }, - { - "path": "pages/API/set-navigation-bar-color/set-navigation-bar-color", - "style": { - "navigationBarTitleText": "设置导航条颜色" - } + { + "path": "pages/API/set-navigation-bar-color/set-navigation-bar-color", + "style": { + "navigationBarTitleText": "设置导航条颜色" + } + }, + { + "path": "pages/API/set-navigation-bar-title/set-navigation-bar-title", + "style": { + "navigationBarTitleText": "设置导航条标题" + } }, { "path": "pages/API/set-navigation-bar-color/set-custom-navigation-bar-color", @@ -1018,7 +1024,7 @@ }, { "path" : "pages/API/install-apk/install-apk", - "style" : + "style" : { "navigationBarTitleText" : "install-apk", "enablePullDownRefresh" : false diff --git a/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js b/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d16c75a23fcfb80571a41b5679169b5413977046 --- /dev/null +++ b/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js @@ -0,0 +1,26 @@ +const CURRENT_PAGE_PATH = + "/pages/API/set-navigation-bar-title/set-navigation-bar-title"; + +describe("setNavigationBarColor", () => { + 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("setNavigationBarTitle", async () => { + await page.callMethod("setNavigationBarTitle"); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + const lifeCycleNum = await page.callMethod("getLifeCycleNum"); + expect(lifeCycleNum - originLifeCycleNum).toBe(2); + }); +}); diff --git a/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue b/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue new file mode 100644 index 0000000000000000000000000000000000000000..5f917f3190b5911750b37f11499a7ee2b8c3ac69 --- /dev/null +++ b/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue @@ -0,0 +1,49 @@ + + + diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue index 839df655a5ad094808e96180f9af89aef37ac4ea..03fa02c73fe1bfbae312db53740c9685ad081c30 100644 --- a/pages/tabBar/API.uvue +++ b/pages/tabBar/API.uvue @@ -97,12 +97,11 @@ url: 'navigator', api: ["navigateTo", "reLaunch", "navigateBack", "redirectTo", "switchTab"] }, - /* + { name: '设置导航条标题', url: 'set-navigation-bar-title', - enable: false, - }, */ + }, { name: '设置导航条颜色', url: 'set-navigation-bar-color',