mdbook/tests/gui/heading-nav-current-to-bottom.goml
Eric Huss 1b55d4a389 Add sidebar heading navigation
This adds dynamic navigation of headers of the current page in the
sidebar. This is intended to help the user see what is on the current
page, and to be able to more easily navigate it. The "current" header is
tracked based on the scrolling behavior of the user, and is marked with
a small circle. This includes automatic folding to help keep it from
being too unwieldy on a page with a lot of nested headers.

This includes the `output.html.sidebar-header-nav` option to disable it.

I'm sure there are tweaks, fixes, and improvements that can be made. I'd
like to get this out now, and iterate on it over time to make
improvements.
2025-08-27 14:44:12 -07:00

58 lines
2.1 KiB
Text

// Checks that the "current" header works even when there are headers near the
// bottom.
set-window-size: (1400, 800)
go-to: |DOC_PATH| + "headings/current-to-bottom.html"
assert-count: (".current-header", 1)
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-1"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-2"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-3"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-4"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-5"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-6"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-7"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-8"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-9"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-10"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-11"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-12"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-13"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-14"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-15"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-16"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-17"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-18"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-19"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-20"
assert-text: (".current-header", "First header")
scroll-to: "#scroll-to-21"
wait-for-text: (".current-header", "Second sub-header")
scroll-to: "#scroll-to-22"
assert-text: (".current-header", "Second sub-header")
scroll-to: "#scroll-to-23"
assert-text: (".current-header", "Second sub-header")
scroll-to: "#scroll-to-24"
assert-text: (".current-header", "Second sub-header")
scroll-to: "#scroll-to-25"
wait-for-text: (".current-header", "Fifth header")