rustdoc: add test cases for mile wide bar

This commit is contained in:
Michael Howell 2024-07-16 10:04:40 -07:00
parent 3924493a10
commit 55149061ea
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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})