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.
36 lines
1.1 KiB
Text
36 lines
1.1 KiB
Text
// This tests pressing the left and right arrows moving to previous and next page.
|
|
|
|
go-to: |DOC_PATH| + "index.html"
|
|
|
|
// default page is the first numbered page
|
|
assert-text: ("title", "Introduction - mdBook test book")
|
|
|
|
// Moving left we get to the prefix page
|
|
press-key: 'ArrowLeft'
|
|
assert-text: ("title", "Prefix Chapter - mdBook test book")
|
|
|
|
// Trying to move to the left beyond the prefix pages - nothing changes
|
|
press-key: 'ArrowLeft'
|
|
assert-text: ("title", "Prefix Chapter - mdBook test book")
|
|
|
|
// Back to the main page
|
|
press-key: 'ArrowRight'
|
|
assert-text: ("title", "Introduction - mdBook test book")
|
|
|
|
press-key: 'ArrowRight'
|
|
assert-text: ("title", "Markdown Individual tags - mdBook test book")
|
|
|
|
press-key: 'ArrowRight'
|
|
assert-text: ("title", "Heading - mdBook test book")
|
|
|
|
// Last numbered page
|
|
go-to: "../last.html"
|
|
assert-text: ("title", "Last numbered chapter - mdBook test book")
|
|
|
|
// Go to the suffix chapter
|
|
press-key: 'ArrowRight'
|
|
assert-text: ("title", "Suffix Chapter - mdBook test book")
|
|
|
|
// Try to go beyond the last page
|
|
press-key: 'ArrowRight'
|
|
assert-text: ("title", "Suffix Chapter - mdBook test book")
|