From c12c68e5eb233444b169c58ad576e12a65c8f3e8 Mon Sep 17 00:00:00 2001 From: evan Date: Wed, 10 Mar 2021 17:31:34 -0600 Subject: [PATCH 1/6] allow user configured navbar selection --- docs/configuration.md | 13 +++++++++++++ src/core/render/index.js | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 3ea277698..aea292b2f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -88,6 +88,19 @@ window.$docsify = { }; ``` +## nav_el + +- Type: `String` +- Default: `null` + +The DOM element to use for rendering the navbar. It can be a CSS selector string or an actual [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). If `null`, the first ` + + + `, + markdown: { + navbar: ` + - [Foo](foo) + - [Bar](bar) + `, + homepage: ` + # hello world + foo + `, + }, + config: { + nav_el: '#mynav', + }, + }; + + await docsifyInit(docsifyInitConfig); + await expect(page).toHaveText( + '#mynav', + '
  • Foo
  • ' + ); + await expect(page).toHaveText( + '#mynav', + '
  • Bar
  • ' + ); + }); +}); From cf05a6fe76d95c168ad371383250fac626f94a96 Mon Sep 17 00:00:00 2001 From: evan Date: Wed, 23 Jun 2021 02:42:20 -0500 Subject: [PATCH 3/6] fix tests to use innerHTML --- test/e2e/nav.test.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/e2e/nav.test.js b/test/e2e/nav.test.js index 598ab5688..bb386b118 100644 --- a/test/e2e/nav.test.js +++ b/test/e2e/nav.test.js @@ -27,13 +27,12 @@ describe(`Navbar tests`, function() { }; await docsifyInit(docsifyInitConfig); - await expect(page).toHaveText( - '#mynav', - '
  • Foo
  • ' - ); - await expect(page).toHaveText( - '#mynav', - '
  • Bar
  • ' - ); + + // Check that our custom