|
| 1 | +// This test ensures that the "Auto-hide item methods' documentation" setting is working as |
| 2 | +// expected. |
| 3 | + |
| 4 | +define-function: ( |
| 5 | + "check-setting", |
| 6 | + (storage_value, setting_attribute_value, toggle_attribute_value), |
| 7 | + block { |
| 8 | + assert-local-storage: {"rustdoc-auto-hide-method-docs": |storage_value|} |
| 9 | + click: "#settings-menu" |
| 10 | + wait-for: "#settings" |
| 11 | + assert-property: ("#auto-hide-method-docs", {"checked": |setting_attribute_value|}) |
| 12 | + assert-attribute: (".toggle.method-toggle", {"open": |toggle_attribute_value|}) |
| 13 | + } |
| 14 | +) |
| 15 | + |
| 16 | +goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" |
| 17 | + |
| 18 | +// We check that the setting is disabled by default. |
| 19 | +call-function: ("check-setting", { |
| 20 | + "storage_value": null, |
| 21 | + "setting_attribute_value": "false", |
| 22 | + "toggle_attribute_value": "", |
| 23 | +}) |
| 24 | + |
| 25 | +// Now we change its value. |
| 26 | +click: "#auto-hide-method-docs" |
| 27 | +assert-local-storage: {"rustdoc-auto-hide-method-docs": "true"} |
| 28 | + |
| 29 | +// We check that the changes were applied as expected. |
| 30 | +reload: |
| 31 | + |
| 32 | +call-function: ("check-setting", { |
| 33 | + "storage_value": "true", |
| 34 | + "setting_attribute_value": "true", |
| 35 | + "toggle_attribute_value": null, |
| 36 | +}) |
| 37 | + |
| 38 | +// And now we re-disable the setting. |
| 39 | +click: "#auto-hide-method-docs" |
| 40 | +assert-local-storage: {"rustdoc-auto-hide-method-docs": "false"} |
| 41 | + |
| 42 | +// And we check everything is back the way it was before. |
| 43 | +reload: |
| 44 | +call-function: ("check-setting", { |
| 45 | + "storage_value": "false", |
| 46 | + "setting_attribute_value": "false", |
| 47 | + "toggle_attribute_value": "", |
| 48 | +}) |
0 commit comments