Skip to content

Commit

Permalink
rustdoc: add test cases for mile wide bar
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jul 16, 2024
1 parent 3924493 commit 5514906
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/rustdoc-gui/huge-logo.goml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set-window-size: (1280, 1024)
assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "96", "offsetHeight": 48})
// offsetWidth = width of sidebar, offsetHeight = height + top padding
assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 64})
assert-css: (".sidebar-crate .logo-container img", {"border-top-width": "16px", "margin-top": "-16px"})

set-window-size: (400, 600)
// offset = size + margin
Expand Down
15 changes: 15 additions & 0 deletions tests/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,18 @@ assert-property: (".sidebar .sidebar-crate h2 a", {
"offsetTop": |index_sidebar_y|,
"offsetLeft": |index_sidebar_x|,
})

// Check that the sidebar links touch the left side of the box
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-position: (".sidebar .block a", {"x": -4})
assert-position: (".sidebar-crate > h2 > a", {"x": -3})

// Check that the main sidebar links touch the left side of the box
// but the crate name doesn't, because the logo takes that space
go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html"
assert-position: (".sidebar .block a", {"x": -4})
// when side-by-side, it's not line wrapped
assert-position-false: (".sidebar-crate > h2 > a", {"x": -3})
// when line-wrapped, see that it becomes flush-left again
drag-and-drop: ((205, 100), (108, 100))
assert-position: (".sidebar-crate > h2 > a", {"x": -3})

0 comments on commit 5514906

Please sign in to comment.