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