]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc-gui/search-filter.goml
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / rustdoc-gui / search-filter.goml
CommitLineData
5099ac24 1// Checks that the crate search filtering is handled correctly and changes the results.
136023e0 2goto: file://|DOC_PATH|/test_docs/index.html
3c0e092e 3show-text: true
136023e0 4write: (".search-input", "test")
064997fb
FG
5// To be SURE that the search will be run.
6press-key: 'Enter'
136023e0
XL
7// Waiting for the search results to appear...
8wait-for: "#titles"
9assert-text: ("#results .externcrate", "test_docs")
3c0e092e 10
5099ac24 11wait-for: "#crate-search"
136023e0
XL
12// We now want to change the crate filter.
13click: "#crate-search"
14// We select "lib2" option then press enter to change the filter.
15press-key: "ArrowDown"
5099ac24 16press-key: "ArrowDown"
136023e0 17press-key: "Enter"
136023e0
XL
18// Waiting for the search results to appear...
19wait-for: "#titles"
5e7ed085 20assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
136023e0
XL
21// We check that there is no more "test_docs" appearing.
22assert-false: "#results .externcrate"
5099ac24
FG
23// We also check that "lib2" is the filter crate.
24assert-property: ("#crate-search", {"value": "lib2"})
25
26// Now we check that leaving the search results and putting them back keeps the
27// crate filtering.
28press-key: "Escape"
5e7ed085 29wait-for-css: ("#main-content", {"display": "block"})
5099ac24 30focus: ".search-input"
5e7ed085 31wait-for-css: ("#main-content", {"display": "none"})
5099ac24
FG
32// We check that there is no more "test_docs" appearing.
33assert-false: "#results .externcrate"
34assert-property: ("#crate-search", {"value": "lib2"})
35
36// Selecting back "All crates"
37click: "#crate-search"
38press-key: "ArrowUp"
39press-key: "ArrowUp"
40press-key: "Enter"
41// Waiting for the search results to appear...
42wait-for: "#titles"
f2b60f7d 43assert-property: ("#crate-search", {"value": "all crates"})
5099ac24
FG
44
45// Checking that the URL parameter is taken into account for crate filtering.
46goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
47wait-for: "#crate-search"
48assert-property: ("#crate-search", {"value": "lib2"})
49assert-false: "#results .externcrate"
923072b8 50
f2b60f7d
FG
51// Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
52assert-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.
56local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
57reload:
58
59timeout: 2000
60wait-for: "#crate-search"
61assert-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.
68click: "#settings-menu"
69wait-for: "#settings"
70click: "#theme-dark"
71wait-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.
78click: "#theme-ayu"
79wait-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})