Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search GUI fixes #97113

Merged
merged 5 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1
0.9.2
3 changes: 1 addition & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ table,
margin-left: 0.25em;
padding-left: 0.3125em;
padding-right: 23px;
border: 0;
border: 1px solid;
border-radius: 4px;
outline: none;
cursor: pointer;
Expand Down Expand Up @@ -2010,7 +2010,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {

#crate-search {
border-radius: 4px;
border: 0;
}

.docblock {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ details.undocumented > summary::before {

#crate-search, .search-input {
background-color: #141920;
border-color: #424c57;
color: #c5c5c5;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #424c57 !important;
}

.search-input {
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ details.undocumented > summary::before {
#crate-search, .search-input {
color: #111;
background-color: #f0f0f0;
border-color: #000;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #f0f0f0 !important;
}

.search-input {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ details.undocumented > summary::before {
}

#crate-search, .search-input {
color: #555;
background-color: white;
border-color: #e0e0e0;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #e0e0e0 !important;
}

.search-input:focus {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ window.initSearch = rawSearchIndex => {

let output = "<div id=\"search-settings\">" +
`<h1 class="search-results-title">Results for ${escape(results.query.userQuery)}` +
`${typeFilter}</h1> in ${crates} </div>`;
`${typeFilter}</h1>${crates}</div>`;
if (results.query.error !== null) {
output += `<h3>Query parser error: "${results.query.error}".</h3>`;
output += "<div id=\"titles\">" +
Expand Down
34 changes: 34 additions & 0 deletions src/test/rustdoc-gui/search-filter.goml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,37 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
wait-for: "#crate-search"
assert-property: ("#crate-search", {"value": "lib2"})
assert-false: "#results .externcrate"

// Checking that the text for the "title" is correct (the "All" comes from the "<select>").
assert-text: ("#search-settings", "Results for test in All", STARTS_WITH)

// Checking the display of the crate filter.
// We start with the light theme.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

timeout: 2000
wait-for: "#crate-search"
assert-css: ("#crate-search", {
"border": "1px solid rgb(224, 224, 224)",
"color": "rgb(0, 0, 0)",
"background-color": "rgb(255, 255, 255)",
})

// We now check the dark theme.
click: "#settings-menu"
wait-for: "#settings"
click: "#theme-dark"
wait-for-css: ("#crate-search", {
"border": "1px solid rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
"background-color": "rgb(240, 240, 240)",
})

// And finally we check the ayu theme.
click: "#theme-ayu"
wait-for-css: ("#crate-search", {
"border": "1px solid rgb(66, 76, 87)",
"color": "rgb(197, 197, 197)",
"background-color": "rgb(20, 25, 32)",
})