Skip to content

rustdoc: instead of .setting-name { width: 100% }, use default div CSS #106996

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

Merged
merged 2 commits into from
Jan 18, 2023
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
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
padding-bottom: 1px;
}

.radio-line .setting-name {
width: 100%;
}

.radio-line .choice {
margin-top: 0.1em;
margin-bottom: 0.1em;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
// This is a select setting.
output += `\
<div class="radio-line" id="${js_data_name}">
<span class="setting-name">${setting_name}</span>
<div class="setting-name">${setting_name}</div>
<div class="choices">`;
onEach(setting["options"], option => {
const checked = option === setting["default"] ? " checked" : "";
Expand Down
27 changes: 27 additions & 0 deletions tests/rustdoc-gui/settings.goml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,33 @@ assert-css: (
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
},
)
// Now we check the setting-name for radio buttons is on a different line than the label.
compare-elements-position-near: (
"#theme .setting-name",
"#theme .choices",
{"x": 1}
)
compare-elements-position-near-false: (
"#theme .setting-name",
"#theme .choices",
{"y": 1}
)
// Now we check that the label positions are all on the same line.
compare-elements-position-near: (
"#theme .choices #theme-light",
"#theme .choices #theme-dark",
{"y": 1}
)
compare-elements-position-near: (
"#theme .choices #theme-dark",
"#theme .choices #theme-ayu",
{"y": 1}
)
compare-elements-position-near: (
"#theme .choices #theme-ayu",
"#theme .choices #theme-system-preference",
{"y": 1}
)

// First we check the "default" display for toggles.
assert-css: (
Expand Down