]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc-gui/sidebar-mobile.goml
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / rustdoc-gui / sidebar-mobile.goml
CommitLineData
136023e0
XL
1// This test ensure that the sidebar isn't "hidden" on mobile but instead moved out of the viewport.
2// This is especially important for devices for "text-first" content (like for users with
3// sight issues).
4goto: file://|DOC_PATH|/test_docs/struct.Foo.html
5// Switching to "mobile view" by reducing the width to 600px.
6size: (600, 600)
5099ac24 7assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
136023e0 8// Opening the sidebar menu.
5099ac24
FG
9click: ".sidebar-menu-toggle"
10assert-css: (".sidebar", {"display": "block", "left": "0px"})
136023e0 11// Closing the sidebar menu.
5099ac24
FG
12click: ".sidebar-menu-toggle"
13assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
136023e0
XL
14// Force the sidebar open by focusing a link inside it.
15// This makes it easier for keyboard users to get to it.
16focus: ".sidebar-title a"
5099ac24 17assert-css: (".sidebar", {"display": "block", "left": "0px"})
136023e0
XL
18// When we tab out of the sidebar, close it.
19focus: ".search-input"
5099ac24
FG
20assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
21
22// Open the sidebar menu.
23click: ".sidebar-menu-toggle"
24assert-css: (".sidebar", {"left": "0px"})
25
26// Click elsewhere.
27click: "body"
28assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
29
30// Check that the topbar is visible
31assert-property: (".mobile-topbar", {"clientHeight": "45"})
32
33// Check that clicking an element from the sidebar scrolls to the right place
34// so the target is not obscured by the topbar.
35click: ".sidebar-menu-toggle"
36click: ".sidebar-elems section .block li > a"
37assert-position: ("#method\.must_use", {"y": 45})
38
39// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
40click: ".sidebar-menu-toggle"
41scroll-to: ".block.keyword li:nth-child(1)"
42compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543})
064997fb
FG
43
44// Now checking the background color of the sidebar.
45local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
46reload:
47
48// Open the sidebar menu.
49click: ".sidebar-menu-toggle"
50assert-css: (".sidebar", {"background-color": "rgb(80, 80, 80)"})
51
52local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "ayu"}
53reload:
54
55// Open the sidebar menu.
56click: ".sidebar-menu-toggle"
57assert-css: (".sidebar", {"background-color": "rgb(20, 25, 31)"})
58
59local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "light"}
60reload:
61
62// Open the sidebar menu.
63click: ".sidebar-menu-toggle"
64assert-css: (".sidebar", {"background-color": "rgb(245, 245, 245)"})