]>
Commit | Line | Data |
---|---|---|
5099ac24 | 1 | // Checks that the crate search filtering is handled correctly and changes the results. |
136023e0 | 2 | goto: file://|DOC_PATH|/test_docs/index.html |
3c0e092e | 3 | show-text: true |
136023e0 | 4 | write: (".search-input", "test") |
064997fb FG |
5 | // To be SURE that the search will be run. |
6 | press-key: 'Enter' | |
136023e0 XL |
7 | // Waiting for the search results to appear... |
8 | wait-for: "#titles" | |
9 | assert-text: ("#results .externcrate", "test_docs") | |
3c0e092e | 10 | |
5099ac24 | 11 | wait-for: "#crate-search" |
136023e0 XL |
12 | // We now want to change the crate filter. |
13 | click: "#crate-search" | |
14 | // We select "lib2" option then press enter to change the filter. | |
15 | press-key: "ArrowDown" | |
5099ac24 | 16 | press-key: "ArrowDown" |
136023e0 | 17 | press-key: "Enter" |
136023e0 XL |
18 | // Waiting for the search results to appear... |
19 | wait-for: "#titles" | |
5e7ed085 | 20 | assert-document-property: ({"URL": "&filter-crate="}, CONTAINS) |
136023e0 XL |
21 | // We check that there is no more "test_docs" appearing. |
22 | assert-false: "#results .externcrate" | |
5099ac24 FG |
23 | // We also check that "lib2" is the filter crate. |
24 | assert-property: ("#crate-search", {"value": "lib2"}) | |
25 | ||
26 | // Now we check that leaving the search results and putting them back keeps the | |
27 | // crate filtering. | |
28 | press-key: "Escape" | |
5e7ed085 | 29 | wait-for-css: ("#main-content", {"display": "block"}) |
5099ac24 | 30 | focus: ".search-input" |
5e7ed085 | 31 | wait-for-css: ("#main-content", {"display": "none"}) |
5099ac24 FG |
32 | // We check that there is no more "test_docs" appearing. |
33 | assert-false: "#results .externcrate" | |
34 | assert-property: ("#crate-search", {"value": "lib2"}) | |
35 | ||
36 | // Selecting back "All crates" | |
37 | click: "#crate-search" | |
38 | press-key: "ArrowUp" | |
39 | press-key: "ArrowUp" | |
40 | press-key: "Enter" | |
41 | // Waiting for the search results to appear... | |
42 | wait-for: "#titles" | |
f2b60f7d | 43 | assert-property: ("#crate-search", {"value": "all crates"}) |
5099ac24 FG |
44 | |
45 | // Checking that the URL parameter is taken into account for crate filtering. | |
46 | goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2 | |
47 | wait-for: "#crate-search" | |
48 | assert-property: ("#crate-search", {"value": "lib2"}) | |
49 | assert-false: "#results .externcrate" | |
923072b8 | 50 | |
f2b60f7d FG |
51 | // Checking that the text for the "title" is correct (the "all crates" comes from the "<select>"). |
52 | assert-text: (".search-results-title", "Results in all crates", STARTS_WITH) | |
923072b8 FG |
53 | |
54 | // Checking the display of the crate filter. | |
55 | // We start with the light theme. | |
56 | local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} | |
57 | reload: | |
58 | ||
59 | timeout: 2000 | |
60 | wait-for: "#crate-search" | |
61 | assert-css: ("#crate-search", { | |
62 | "border": "1px solid rgb(224, 224, 224)", | |
63 | "color": "rgb(0, 0, 0)", | |
64 | "background-color": "rgb(255, 255, 255)", | |
65 | }) | |
66 | ||
67 | // We now check the dark theme. | |
68 | click: "#settings-menu" | |
69 | wait-for: "#settings" | |
70 | click: "#theme-dark" | |
71 | wait-for-css: ("#crate-search", { | |
f2b60f7d FG |
72 | "border": "1px solid rgb(224, 224, 224)", |
73 | "color": "rgb(221, 221, 221)", | |
74 | "background-color": "rgb(53, 53, 53)", | |
923072b8 FG |
75 | }) |
76 | ||
77 | // And finally we check the ayu theme. | |
78 | click: "#theme-ayu" | |
79 | wait-for-css: ("#crate-search", { | |
f2b60f7d FG |
80 | "border": "1px solid rgb(92, 103, 115)", |
81 | "color": "rgb(255, 255, 255)", | |
82 | "background-color": "rgb(15, 20, 25)", | |
923072b8 | 83 | }) |