This fixes an issue when folding is enabled. The folding was not properly hiding the sub-chapters because it was assuming it could hide the next list element. However, the heading nav was the next list element, so the remaining chapters remained visible. The solution required some deeper changes to how the chapters were organized in the sidebar. Instead of nested chapters being a list element *sibling*, the nested chapter's `ol` is now a *child* of its parent chapter. This makes it much easier to just hide everything without regard of the exact sibling order. This required wrapping the chapter title and the toggle chevron inside a span so that the flex layout could be localized to just those elements, and allow the following `ol` elements to lay out regularly. Closes https://github.com/rust-lang/mdBook/issues/2880
15 lines
504 B
Text
15 lines
504 B
Text
// When there is a large intro, there shouldn't be any "current" headers until
|
|
// you scroll down and make it visible on screen.
|
|
|
|
set-window-size: (1400, 800)
|
|
go-to: |DOC_PATH| + "heading-nav/large-intro.html"
|
|
assert-count: (".header-item", 1)
|
|
assert-count: (".current-header", 0)
|
|
|
|
scroll-to: "#first-header"
|
|
wait-for-count: (".current-header", 1)
|
|
assert-text: (".current-header", "First header")
|
|
|
|
// Scrolling back to the top should set it to 0.
|
|
scroll-to: (0, 0)
|
|
wait-for-count: (".current-header", 0)
|