fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB51 linesraw
1// This tests checks that the "scraped examples" toggle is working as expected.
2go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
3
4// Checking the color of the toggle line.
5show-text: true
6define-function: (
7    "check-color",
8    (theme, toggle_line_color, toggle_line_hover_color),
9    block {
10        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
11        reload:
12
13        // Clicking "More examples..." will open additional examples
14        assert-attribute-false: (".more-examples-toggle", {"open": ""})
15        click: ".more-examples-toggle"
16        assert-attribute: (".more-examples-toggle", {"open": ""})
17
18        assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
19        move-cursor-to: ".toggle-line"
20        assert-css: (
21            ".toggle-line:hover .toggle-line-inner",
22            {"background-color": |toggle_line_hover_color|},
23        )
24        // Moving cursor away from the toggle line to prevent disrupting next test.
25        move-cursor-to: ".search-input"
26    },
27)
28
29call-function: ("check-color", {
30    "theme": "ayu",
31    "toggle_line_color": "#999",
32    "toggle_line_hover_color": "#c5c5c5",
33})
34call-function: ("check-color", {
35    "theme": "dark",
36    "toggle_line_color": "#999",
37    "toggle_line_hover_color": "#c5c5c5",
38})
39call-function: ("check-color", {
40    "theme": "light",
41    "toggle_line_color": "#ccc",
42    "toggle_line_hover_color": "#999",
43})
44
45// Toggling all docs will close additional examples
46click: "#toggle-all-docs"
47assert-attribute-false: (".more-examples-toggle", {"open": ""})
48
49// After re-opening the docs, the additional examples should stay closed
50click: "#toggle-all-docs"
51assert-attribute-false: (".more-examples-toggle", {"open": ""})