1 // Checks that the crate search filtering is handled correctly and changes the results.
2 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
4 write: (".search-input", "test")
5 // To be SURE that the search will be run.
7 // Waiting for the search results to appear...
9 assert-text: ("#results .externcrate", "test_docs")
11 wait-for: "#crate-search"
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"
16 press-key: "ArrowDown"
17 press-key: "ArrowDown"
19 // Waiting for the search results to appear...
21 assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
22 // We check that there is no more "test_docs" appearing.
23 assert-false: "#results .externcrate"
24 // We also check that "lib2" is the filter crate.
25 assert-property: ("#crate-search", {"value": "lib2"})
27 // Now we check that leaving the search results and putting them back keeps the
30 wait-for-css: ("#main-content", {"display": "block"})
31 focus: ".search-input"
32 wait-for-css: ("#main-content", {"display": "none"})
33 // We check that there is no more "test_docs" appearing.
34 assert-false: "#results .externcrate"
35 assert-property: ("#crate-search", {"value": "lib2"})
37 // Selecting back "All crates"
38 click: "#crate-search"
43 // Waiting for the search results to appear...
45 assert-property: ("#crate-search", {"value": "all crates"})
47 // Checking that the URL parameter is taken into account for crate filtering.
48 goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2"
49 wait-for: "#crate-search"
50 assert-property: ("#crate-search", {"value": "lib2"})
51 assert-false: "#results .externcrate"
53 // Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
54 assert-text: (".search-results-title", "Results in all crates", STARTS_WITH)
56 // Checking the display of the crate filter.
57 // We start with the light theme.
58 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
62 wait-for: "#crate-search"
63 assert-css: ("#crate-search", {
64 "border": "1px solid rgb(224, 224, 224)",
65 "color": "rgb(0, 0, 0)",
66 "background-color": "rgb(255, 255, 255)",
69 // We now check the dark theme.
70 click: "#settings-menu"
73 wait-for-css: ("#crate-search", {
74 "border": "1px solid rgb(224, 224, 224)",
75 "color": "rgb(221, 221, 221)",
76 "background-color": "rgb(53, 53, 53)",
79 // And finally we check the ayu theme.
81 wait-for-css: ("#crate-search", {
82 "border": "1px solid rgb(92, 103, 115)",
83 "color": "rgb(255, 255, 255)",
84 "background-color": "rgb(15, 20, 25)",