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
8 changes: 4 additions & 4 deletions tests/gui/sidebar-active.goml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

go-to: |DOC_PATH| + "all-summary/index.html"

assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1")
assert-text: (".sidebar-scrollbox a.active", "Prefix 1")

go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html"

assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1")
assert-text: (".sidebar-scrollbox a.active", "3. P1 C1")

go-to: |DOC_PATH| + "all-summary/index.html?highlight=test"

assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1")
assert-text: (".sidebar-scrollbox a.active", "Prefix 1")

go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html?highlight=test"

assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1")
assert-text: (".sidebar-scrollbox a.active", "3. P1 C1")
28 changes: 14 additions & 14 deletions tests/gui/sidebar-scroll.goml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
store-value: (windowHeight, 900)
set-window-size: (1200, |windowHeight|)
go-to: |DOC_PATH| + "sidebar-scroll/index.html"
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0})
assert-property: (".sidebar-scrollbox", {"scrollTop": 0})

click: ".chapter a[href='chapter_2.html']"
assert-text: ("title", "Chapter 2 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0})
assert-property: (".sidebar-scrollbox", {"scrollTop": 0})

click: ".chapter a[href='chapter_10.html']"
assert-text: ("title", "Chapter 10 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0})
assert-property: (".sidebar-scrollbox", {"scrollTop": 0})

// Check that heading nav of chapter 10 pushes 11 off the bottom.
store-position: (".chapter a[href='chapter_11.html']", {"y": chapter_y})
Expand All @@ -21,16 +21,16 @@ assert: |chapter_y| > |windowHeight|
// in position since there are only a few lines above.
click: ".chapter a[href='chapter_11.html']"
assert-text: ("title", "Chapter 11 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0})
assert-property: (".sidebar-scrollbox", {"scrollTop": 0})

// Scroll down a little, and click on a chapter that can stay in place when
// clicked.
scroll-element-to: ("mdbook-sidebar-scrollbox", (0, 230))
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
scroll-element-to: (".sidebar-scrollbox", (0, 230))
store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
assert: |sidebarScrollTop| > 0
click: ".chapter a[href='chapter_35.html']"
assert-text: ("title", "Chapter 35 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})

// Go to the next chapter, and verify that it scrolls to the middle.
press-key: "ArrowRight"
Expand All @@ -42,24 +42,24 @@ assert: |active_y| > 400
assert: |active_y| < 450

// Go to something near the top, it shouldn't scroll.
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_24.html']"
assert-text: ("title", "Chapter 24 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})

// Go to the last chapter, and verify it is scrolled to the bottom.
go-to: |DOC_PATH| + "sidebar-scroll/chapter_100.html"
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": scrollTop, "scrollHeight": scrollHeight, "clientHeight": clientHeight})
store-property: (".sidebar-scrollbox", {"scrollTop": scrollTop, "scrollHeight": scrollHeight, "clientHeight": clientHeight})
// This needs to be approximate since there is a slight difference.
assert: |scrollTop| >= |scrollHeight| - |clientHeight| - 1

// Clicking upwards shouldn't scroll.
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_97.html']"
assert-text: ("title", "Chapter 97 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})

store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_76.html']"
assert-text: ("title", "Chapter 76 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})