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"
18 // Waiting for the search results to appear...
20 assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
21 // We check that there is no more "test_docs" appearing.
22 assert-false: "#results .externcrate"
23 // We also check that "lib2" is the filter crate.
24 assert-property: ("#crate-search", {"value": "lib2"})
26 // Now we check that leaving the search results and putting them back keeps the
29 wait-for-css: ("#main-content", {"display": "block"})
30 focus: ".search-input"
31 wait-for-css: ("#main-content", {"display": "none"})
32 // We check that there is no more "test_docs" appearing.
33 assert-false: "#results .externcrate"
34 assert-property: ("#crate-search", {"value": "lib2"})
36 // Selecting back "All crates"
37 click: "#crate-search"
41 // Waiting for the search results to appear...
43 assert-property: ("#crate-search", {"value": "all crates"})
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"
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)
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"}
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)",
67 // We now check the dark theme.
68 click: "#settings-menu"
71 wait-for-css: ("#crate-search", {
72 "border": "1px solid rgb(224, 224, 224)",
73 "color": "rgb(221, 221, 221)",
74 "background-color": "rgb(53, 53, 53)",
77 // And finally we check the ayu theme.
79 wait-for-css: ("#crate-search", {
80 "border": "1px solid rgb(92, 103, 115)",
81 "color": "rgb(255, 255, 255)",
82 "background-color": "rgb(15, 20, 25)",