Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/front-end/templates/toc.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
17 changes: 17 additions & 0 deletions tests/gui/sidebar-active.goml
Original file line number Diff line number Diff line change
@@ -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")