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

Fix display of search result crate filter dropdown #99086

Merged
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
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,6 @@ table,
#crate-search {
min-width: 115px;
margin-top: 5px;
margin-left: 0.25em;
notriddle marked this conversation as resolved.
Show resolved Hide resolved
padding-left: 0.3125em;
padding-right: 23px;
border: 1px solid;
Expand All @@ -941,6 +940,8 @@ table,
background-size: 20px;
background-position: calc(100% - 1px) 56%;
background-image: /* AUTOREPLACE: */url("down-arrow.svg");
max-width: 100%;
text-overflow: ellipsis;
}
.search-container {
margin-top: 4px;
Expand Down
28 changes: 28 additions & 0 deletions src/test/rustdoc-gui/search-result-display.goml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,31 @@ size: (600, 100)
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
// when computed it's larger.
assert-css: (".search-results div.desc", {"width": "570px"})

// Check that the crate filter `<select>` is correctly handled when it goes to next line.
// To do so we need to update the length of one of its `<option>`.
size: (900, 900)

// First we check the current width and position.
assert-css: ("#crate-search", {"width": "222px"})
compare-elements-position-near: (
"#crate-search",
"#search-settings .search-results-title",
{"y": 5},
)

// Then we update the text of one of the `<option>`.
text: (
"#crate-search option",
"sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa",
)

// Then we compare again.
assert-css: ("#crate-search", {"width": "640px"})
compare-elements-position-near-false: (
"#crate-search",
"#search-settings .search-results-title",
{"y": 5},
)
// And we check that the `<select>` isn't bigger than its container.
assert-css: ("#search", {"width": "640px"})