Skip to content

Commit ab1573a

Browse files
Add GUI test for "Auto-hide item contents for large items" setting
1 parent 12c1385 commit ab1573a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// This test ensures that the "Auto-hide item contents for large items" setting is working as
2+
// expected.
3+
4+
// We need to disable this check because `implementors/test_docs/trait.Iterator.js` doesn't exist.
5+
fail-on-request-error: false
6+
7+
define-function: (
8+
"check-setting",
9+
(storage_value, setting_attribute_value, toggle_attribute_value),
10+
block {
11+
assert-local-storage: {"rustdoc-auto-hide-large-items": |storage_value|}
12+
click: "#settings-menu"
13+
wait-for: "#settings"
14+
assert-property: ("#auto-hide-large-items", {"checked": |setting_attribute_value|})
15+
assert-attribute: (".item-decl .type-contents-toggle", {"open": |toggle_attribute_value|})
16+
}
17+
)
18+
19+
goto: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html"
20+
21+
// We check that the setting is enabled by default and is working.
22+
call-function: ("check-setting", {
23+
"storage_value": null,
24+
"setting_attribute_value": "true",
25+
"toggle_attribute_value": null,
26+
})
27+
28+
// Now we change its value.
29+
click: "#auto-hide-large-items"
30+
assert-local-storage: {"rustdoc-auto-hide-large-items": "false"}
31+
32+
// We check that the changes were applied as expected.
33+
reload:
34+
35+
call-function: ("check-setting", {
36+
"storage_value": "false",
37+
"setting_attribute_value": "false",
38+
"toggle_attribute_value": "",
39+
})
40+
41+
// And now we re-enable the setting.
42+
click: "#auto-hide-large-items"
43+
assert-local-storage: {"rustdoc-auto-hide-large-items": "true"}
44+
45+
// And we check everything is back the way it was before.
46+
reload:
47+
call-function: ("check-setting", {
48+
"storage_value": "true",
49+
"setting_attribute_value": "true",
50+
"toggle_attribute_value": null,
51+
})

0 commit comments

Comments
 (0)