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 methods alignment on mobile #131417

Merged
merged 3 commits into from
Oct 10, 2024
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
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ in src-script.js and main.js
}

/* Position of the "[-]" element. */
details.toggle:not(.top-doc) > summary {
details.toggle:not(.top-doc) > summary, .impl-items > section {
margin-left: 10px;
}
.impl-items > details.toggle > summary:not(.hideme)::before,
Expand Down
19 changes: 19 additions & 0 deletions tests/rustdoc-gui/methods-left-margin.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This test is to ensure that methods are correctly aligned on the left side.

go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"

// First we ensure that we have methods with and without documentation.
assert: ".impl-items > details.method-toggle > summary > section.method"
assert: ".impl-items > section.method"

// Checking on desktop.
set-window-size: (900, 600)
wait-for-size: ("body", {"width": 900})
store-position: (".impl-items section.method", {"x": x})
assert-position: (".impl-items section.method", {"x": |x|}, ALL)

// Checking on mobile.
set-window-size: (600, 600)
wait-for-size: ("body", {"width": 600})
store-position: (".impl-items section.method", {"x": x})
assert-position: (".impl-items section.method", {"x": |x|}, ALL)
5 changes: 3 additions & 2 deletions tests/rustdoc-gui/notable-trait.goml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ call-function: ("check-notable-tooltip-position", {

// Checking on mobile now.
set-window-size: (650, 600)
wait-for-size: ("body", {"width": 650})
call-function: ("check-notable-tooltip-position-complete", {
"x": 15,
"i_x": 293,
"x": 25,
"i_x": 303,
"popover_x": 0,
})

Expand Down
Loading