Skip to content

Commit 16bb719

Browse files
Improve "Auto-hide trait implementation documentation" GUI test
1 parent 84dd6df commit 16bb719

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

tests/rustdoc-gui/auto-hide-trait-implementations.goml

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Checks that the setting "auto hide trait implementations" is working as expected.
2+
3+
define-function: (
4+
"check-setting",
5+
(storage_value, setting_attribute_value, toggle_attribute_value),
6+
block {
7+
assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|}
8+
click: "#settings-menu"
9+
wait-for: "#settings"
10+
assert-property: ("#auto-hide-trait-implementations", {"checked": |setting_attribute_value|})
11+
assert-attribute: ("#trait-implementations-list > details", {"open": |toggle_attribute_value|}, ALL)
12+
}
13+
)
14+
15+
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
16+
17+
// By default, the trait implementations are not collapsed.
18+
call-function: ("check-setting", {
19+
"storage_value": null,
20+
"setting_attribute_value": "false",
21+
"toggle_attribute_value": "",
22+
})
23+
24+
// Now we change its value.
25+
click: "#auto-hide-trait-implementations"
26+
assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "true"}
27+
28+
// We check that the changes were applied as expected.
29+
reload:
30+
31+
call-function: ("check-setting", {
32+
"storage_value": "true",
33+
"setting_attribute_value": "true",
34+
"toggle_attribute_value": null,
35+
})
36+
37+
// And now we re-disable the setting.
38+
click: "#auto-hide-trait-implementations"
39+
assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "false"}
40+
41+
// And we check everything is back the way it was before.
42+
reload:
43+
call-function: ("check-setting", {
44+
"storage_value": "false",
45+
"setting_attribute_value": "false",
46+
"toggle_attribute_value": "",
47+
})

0 commit comments

Comments
 (0)