]>
Commit | Line | Data |
---|---|---|
9c376795 | 1 | // This tests checks that the "scraped examples" toggle is working as expected. |
353b0b11 | 2 | go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" |
9c376795 FG |
3 | |
4 | // Checking the color of the toggle line. | |
5 | show-text: true | |
6 | define-function: ( | |
7 | "check-color", | |
8 | (theme, toggle_line_color, toggle_line_hover_color), | |
9 | block { | |
353b0b11 | 10 | set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} |
9c376795 FG |
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 | ||
29 | call-function: ("check-color", { | |
30 | "theme": "ayu", | |
31 | "toggle_line_color": "rgb(153, 153, 153)", | |
32 | "toggle_line_hover_color": "rgb(197, 197, 197)", | |
33 | }) | |
34 | call-function: ("check-color", { | |
35 | "theme": "dark", | |
36 | "toggle_line_color": "rgb(153, 153, 153)", | |
37 | "toggle_line_hover_color": "rgb(197, 197, 197)", | |
38 | }) | |
39 | call-function: ("check-color", { | |
40 | "theme": "light", | |
41 | "toggle_line_color": "rgb(204, 204, 204)", | |
42 | "toggle_line_hover_color": "rgb(153, 153, 153)", | |
43 | }) | |
44 | ||
45 | // Toggling all docs will close additional examples | |
46 | click: "#toggle-all-docs" | |
47 | assert-attribute-false: (".more-examples-toggle", {"open": ""}) | |
48 | ||
49 | // After re-opening the docs, the additional examples should stay closed | |
50 | click: "#toggle-all-docs" | |
51 | assert-attribute-false: (".more-examples-toggle", {"open": ""}) |