mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
52 lines
1.7 KiB
Plaintext
52 lines
1.7 KiB
Plaintext
// This tests checks that the "scraped examples" toggle is working as expected.
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
|
|
|
// Checking the color of the toggle line.
|
|
show-text: true
|
|
define-function: (
|
|
"check-color",
|
|
(theme, toggle_line_color, toggle_line_hover_color),
|
|
block {
|
|
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
|
reload:
|
|
|
|
// Clicking "More examples..." will open additional examples
|
|
assert-attribute-false: (".more-examples-toggle", {"open": ""})
|
|
click: ".more-examples-toggle"
|
|
assert-attribute: (".more-examples-toggle", {"open": ""})
|
|
|
|
assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
|
|
move-cursor-to: ".toggle-line"
|
|
assert-css: (
|
|
".toggle-line:hover .toggle-line-inner",
|
|
{"background-color": |toggle_line_hover_color|},
|
|
)
|
|
// Moving cursor away from the toggle line to prevent disrupting next test.
|
|
move-cursor-to: ".search-input"
|
|
},
|
|
)
|
|
|
|
call-function: ("check-color", {
|
|
"theme": "ayu",
|
|
"toggle_line_color": "#999",
|
|
"toggle_line_hover_color": "#c5c5c5",
|
|
})
|
|
call-function: ("check-color", {
|
|
"theme": "dark",
|
|
"toggle_line_color": "#999",
|
|
"toggle_line_hover_color": "#c5c5c5",
|
|
})
|
|
call-function: ("check-color", {
|
|
"theme": "light",
|
|
"toggle_line_color": "#ccc",
|
|
"toggle_line_hover_color": "#999",
|
|
})
|
|
|
|
// 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": ""})
|