mirror of
https://github.com/rust-lang/mdBook
synced 2025-04-29 15:57:31 +08:00
Break off query string when comparing url for sidebar
This commit is contained in:
parent
566a42c4f7
commit
36fa0064de
@ -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…
x
Reference in New Issue
Block a user