2022-12-21 19:21:31 +00:00
|
|
|
// This tests checks that the "scraped examples" toggle is working as expected.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
2022-12-06 17:59:49 +00:00
|
|
|
|
2022-12-24 07:29:17 +00:00
|
|
|
// Checking the color of the toggle line.
|
|
|
|
show-text: true
|
|
|
|
define-function: (
|
|
|
|
"check-color",
|
|
|
|
(theme, toggle_line_color, toggle_line_hover_color),
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2023-04-11 17:11:34 +00:00
|
|
|
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2023-01-06 14:18:51 +00:00
|
|
|
reload:
|
2022-12-24 07:29:17 +00:00
|
|
|
|
|
|
|
// Clicking "More examples..." will open additional examples
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-attribute-false: (".more-examples-toggle", {"open": ""})
|
|
|
|
click: ".more-examples-toggle"
|
|
|
|
assert-attribute: (".more-examples-toggle", {"open": ""})
|
2022-12-24 07:29:17 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
|
|
|
|
move-cursor-to: ".toggle-line"
|
|
|
|
assert-css: (
|
2022-12-24 07:29:17 +00:00
|
|
|
".toggle-line:hover .toggle-line-inner",
|
|
|
|
{"background-color": |toggle_line_hover_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
2022-12-24 07:29:17 +00:00
|
|
|
// Moving cursor away from the toggle line to prevent disrupting next test.
|
2023-01-06 14:18:51 +00:00
|
|
|
move-cursor-to: ".search-input"
|
|
|
|
},
|
2022-12-24 07:29:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "ayu",
|
2023-08-05 10:47:05 +00:00
|
|
|
"toggle_line_color": "#999",
|
|
|
|
"toggle_line_hover_color": "#c5c5c5",
|
2022-12-24 07:29:17 +00:00
|
|
|
})
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "dark",
|
2023-08-05 10:47:05 +00:00
|
|
|
"toggle_line_color": "#999",
|
|
|
|
"toggle_line_hover_color": "#c5c5c5",
|
2022-12-24 07:29:17 +00:00
|
|
|
})
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "light",
|
2023-08-05 10:47:05 +00:00
|
|
|
"toggle_line_color": "#ccc",
|
|
|
|
"toggle_line_hover_color": "#999",
|
2022-12-24 07:29:17 +00:00
|
|
|
})
|
2022-12-06 17:59:49 +00:00
|
|
|
|
|
|
|
// Toggling all docs will close additional examples
|
|
|
|
click: "#toggle-all-docs"
|
|
|
|
assert-attribute-false: (".more-examples-toggle", {"open": ""})
|
|
|
|
|
|
|
|
// After re-opening the docs, the additional examples should stay closed
|
|
|
|
click: "#toggle-all-docs"
|
|
|
|
assert-attribute-false: (".more-examples-toggle", {"open": ""})
|