Merge pull request #2675 from notriddle/sidebar/active-query
Break off query string when comparing url for sidebar
This commit is contained in:
commit
12b4a9631a
2 changed files with 18 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ class MDBookSidebarScrollbox extends HTMLElement {
|
|||
connectedCallback() {
|
||||
this.innerHTML = '{{#toc}}{{/toc}}';
|
||||
// Set the current, active page, and reveal it if it's hidden
|
||||
let current_page = document.location.href.toString().split("#")[0];
|
||||
let current_page = document.location.href.toString().split("#")[0].split("?")[0];
|
||||
if (current_page.endsWith("/")) {
|
||||
current_page += "index.html";
|
||||
}
|
||||
|
|
|
|||
17
tests/gui/sidebar-active.goml
Normal file
17
tests/gui/sidebar-active.goml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// This GUI test checks the active page sidebar highlight.
|
||||
|
||||
go-to: |DOC_PATH| + "index.html"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix Chapter")
|
||||
|
||||
go-to: |DOC_PATH| + "individual/index.html"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. Markdown Individual tags")
|
||||
|
||||
go-to: |DOC_PATH| + "index.html?highlight=test"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix Chapter")
|
||||
|
||||
go-to: |DOC_PATH| + "individual/index.html?highlight=test"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. Markdown Individual tags")
|
||||
Loading…
Add table
Reference in a new issue