about summary refs log tree commit diff
path: root/tests/rustdoc-gui/sidebar-resize-setting.goml
blob: a4572c670f81a94d39a6e6e8f22eaae0025cc680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Checks sidebar resizing stays synced with the setting
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "199"})
show-text: true

// Verify that the "hide" option is unchecked
click: "rustdoc-toolbar .settings-menu"
wait-for: "#settings"
assert-css: ("#settings", {"display": "block"})
assert-property: ("#hide-sidebar", {"checked": "false"})
press-key: "Escape"
wait-for-css: ("#settings", {"display": "none"})

drag-and-drop: ((205, 100), (5, 100))
assert-css: (".sidebar", {"display": "none"})

// Verify that the "hide" option is checked
focus: "rustdoc-toolbar .settings-menu a"
press-key: "Enter"
wait-for-css: ("#settings", {"display": "block"})
assert-property: ("#hide-sidebar", {"checked": "true"})
click: "#hide-sidebar"
wait-for-css: (".sidebar", {"display": "block"})

// Verify that hiding the sidebar hides the source sidebar
// and puts the button in static position mode on mobile
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-window-size: (600, 600)
focus: "rustdoc-topbar .settings-menu a"
press-key: "Enter"
wait-for-css: ("#settings", {"display": "block"})
wait-for-css: ("#sidebar-button", {"position": "static"})
assert-property: ("#hide-sidebar", {"checked": "false"})
click: "#hide-sidebar"
wait-for-css: (".sidebar", {"display": "none"})
wait-for-css: ("#sidebar-button", {"position": "fixed"})
store-position: ("#sidebar-button", {
    "y": sidebar_button_y,
    "x": sidebar_button_x,
})
assert-property: ("#hide-sidebar", {"checked": "true"})
press-key: "Escape"
// Clicking the sidebar button should work, and implicitly re-enable
// the persistent navigation bar
wait-for-css: ("#settings", {"display": "none"})
assert-position: ("#sidebar-button", {
    "y": |sidebar_button_y|,
    "x": |sidebar_button_x|,
})
click: "#sidebar-button"
wait-for-css: (".sidebar", {"display": "block"})