2022-12-21 13:21:31 -06:00
|
|
|
// This tests checks that the "scraped examples" toggle is working as expected.
|
2024-04-05 14:38:55 -05:00
|
|
|
include: "utils.goml"
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
2022-12-06 11:59:49 -06:00
|
|
|
|
2022-12-24 01:29:17 -06:00
|
|
|
// Checking the color of the toggle line.
|
|
|
|
show-text: true
|
|
|
|
define-function: (
|
|
|
|
"check-color",
|
2024-04-01 14:11:22 -05:00
|
|
|
[theme, toggle_line_color, toggle_line_hover_color],
|
2023-01-06 08:18:51 -06:00
|
|
|
block {
|
2024-04-05 14:38:55 -05:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2024-04-08 05:14:41 -05:00
|
|
|
reload:
|
2022-12-24 01:29:17 -06:00
|
|
|
|
|
|
|
// Clicking "More examples..." will open additional examples
|
2023-01-06 08:18:51 -06:00
|
|
|
assert-attribute-false: (".more-examples-toggle", {"open": ""})
|
|
|
|
click: ".more-examples-toggle"
|
|
|
|
assert-attribute: (".more-examples-toggle", {"open": ""})
|
2022-12-24 01:29:17 -06:00
|
|
|
|
2023-01-06 08:18:51 -06:00
|
|
|
assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
|
|
|
|
move-cursor-to: ".toggle-line"
|
|
|
|
assert-css: (
|
2022-12-24 01:29:17 -06:00
|
|
|
".toggle-line:hover .toggle-line-inner",
|
|
|
|
{"background-color": |toggle_line_hover_color|},
|
2023-01-06 08:18:51 -06:00
|
|
|
)
|
2024-04-08 05:14:41 -05:00
|
|
|
// We put the toggle in the original state.
|
|
|
|
click: ".more-examples-toggle"
|
2022-12-24 01:29:17 -06:00
|
|
|
// Moving cursor away from the toggle line to prevent disrupting next test.
|
2023-01-06 08:18:51 -06:00
|
|
|
move-cursor-to: ".search-input"
|
|
|
|
},
|
2022-12-24 01:29:17 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "ayu",
|
2023-08-05 05:47:05 -05:00
|
|
|
"toggle_line_color": "#999",
|
|
|
|
"toggle_line_hover_color": "#c5c5c5",
|
2022-12-24 01:29:17 -06:00
|
|
|
})
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "dark",
|
2023-08-05 05:47:05 -05:00
|
|
|
"toggle_line_color": "#999",
|
|
|
|
"toggle_line_hover_color": "#c5c5c5",
|
2022-12-24 01:29:17 -06:00
|
|
|
})
|
|
|
|
call-function: ("check-color", {
|
|
|
|
"theme": "light",
|
2023-08-05 05:47:05 -05:00
|
|
|
"toggle_line_color": "#ccc",
|
|
|
|
"toggle_line_hover_color": "#999",
|
2022-12-24 01:29:17 -06:00
|
|
|
})
|
2022-12-06 11:59:49 -06: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": ""})
|