From 16844e24850700386b6a7fc482738400a2f115c9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 8 Oct 2024 20:53:11 +0200 Subject: [PATCH 1/3] Fix methods alignment on mobile --- src/librustdoc/html/static/css/rustdoc.css | 2 +- tests/rustdoc-gui/notable-trait.goml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 5f6f3c65c7ff7..3fee73d6e5d18 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -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, diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index b8fa26b17f6b6..43a7e8a8f517c 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -85,8 +85,8 @@ call-function: ("check-notable-tooltip-position", { // Checking on mobile now. set-window-size: (650, 600) call-function: ("check-notable-tooltip-position-complete", { - "x": 15, - "i_x": 293, + "x": 25, + "i_x": 303, "popover_x": 0, }) From 12d5f0aa2cdd3d53d3d273c360773cd5a1a3c821 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 8 Oct 2024 21:14:13 +0200 Subject: [PATCH 2/3] Add GUI regression test for methods left margin on mobile --- tests/rustdoc-gui/methods-left-margin.goml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/rustdoc-gui/methods-left-margin.goml diff --git a/tests/rustdoc-gui/methods-left-margin.goml b/tests/rustdoc-gui/methods-left-margin.goml new file mode 100644 index 0000000000000..af88bbaefc523 --- /dev/null +++ b/tests/rustdoc-gui/methods-left-margin.goml @@ -0,0 +1,17 @@ +// 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) +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) +store-position: (".impl-items section.method", {"x": x}) +assert-position: (".impl-items section.method", {"x": |x|}, ALL) From 5e6033ea8b25d42a56eca04eba5bb33a530bc381 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 9 Oct 2024 21:23:20 +0200 Subject: [PATCH 3/3] Strengthen some GUI tests --- tests/rustdoc-gui/methods-left-margin.goml | 2 ++ tests/rustdoc-gui/notable-trait.goml | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/rustdoc-gui/methods-left-margin.goml b/tests/rustdoc-gui/methods-left-margin.goml index af88bbaefc523..1003cec33f952 100644 --- a/tests/rustdoc-gui/methods-left-margin.goml +++ b/tests/rustdoc-gui/methods-left-margin.goml @@ -8,10 +8,12 @@ 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) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 43a7e8a8f517c..e02974e60829a 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -84,6 +84,7 @@ 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": 25, "i_x": 303,