2021-12-14 10:48:49 +00:00
|
|
|
// The goal of this test is to ensure that the sidebar is working as expected in the source
|
|
|
|
// code pages.
|
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
|
|
|
|
// First: desktop mode.
|
|
|
|
size: (1100, 800)
|
|
|
|
// We check that the sidebar isn't expanded and has the expected width.
|
|
|
|
assert-css: ("nav.sidebar", {"width": "50px"})
|
|
|
|
// We now click on the button to expand the sidebar.
|
|
|
|
click: (10, 10)
|
|
|
|
// We wait for the sidebar to be expanded (there is a 0.5s animation).
|
|
|
|
wait-for: 600
|
|
|
|
assert-css: ("nav.sidebar.expanded", {"width": "300px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("nav.sidebar.expanded a", {"font-size": "14px"})
|
2021-12-14 10:48:49 +00:00
|
|
|
// We collapse the sidebar.
|
|
|
|
click: (10, 10)
|
|
|
|
// We wait for the sidebar to be collapsed (there is a 0.5s animation).
|
|
|
|
wait-for: 600
|
|
|
|
// We ensure that the class has been removed.
|
|
|
|
assert-false: "nav.sidebar.expanded"
|
|
|
|
assert: "nav.sidebar"
|
|
|
|
|
|
|
|
// We now switch to mobile mode.
|
|
|
|
size: (600, 600)
|
|
|
|
// We check that the sidebar has the expected width (0 and 1px for the border).
|
|
|
|
assert-css: ("nav.sidebar", {"width": "1px"})
|
|
|
|
// We expand the sidebar.
|
|
|
|
click: "#sidebar-toggle"
|
|
|
|
assert-css: ("nav.sidebar.expanded", {"width": "600px"})
|
|
|
|
// We collapse the sidebar.
|
|
|
|
click: (10, 10)
|
|
|
|
// We ensure that the class has been removed.
|
|
|
|
assert-false: "nav.sidebar.expanded"
|
|
|
|
assert: "nav.sidebar"
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-07 00:48:24 +00:00
|
|
|
|
|
|
|
// Check that the topbar is not visible
|
|
|
|
assert-property: (".mobile-topbar", {"offsetParent": "null"})
|