diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-06-30 19:55:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-30 19:55:52 +0200 |
| commit | b1403d6b7880db79529cd3adc5ffc3b0b10d6f6a (patch) | |
| tree | 009cf60c09764cdef21328a113f4b649d34ec809 /src/test/rustdoc-gui | |
| parent | 5cd41d7be8f1af027d2d3e38f7ac5d278bf5e0be (diff) | |
| parent | 9a1f52d7fd78f3dc26b49d4490e4e8004f590fc3 (diff) | |
| download | rust-b1403d6b7880db79529cd3adc5ffc3b0b10d6f6a.tar.gz rust-b1403d6b7880db79529cd3adc5ffc3b0b10d6f6a.zip | |
Rollup merge of #98671 - GuillaumeGomez:source-sidebar-fixes, r=notriddle
Fix source sidebar bugs This PR fixes the following two bugs:   I added regression tests to prevent them to happen again. I think we should backport it to beta as well. You can test it [here](https://rustdoc.crud.net/imperio/source-sidebar-fixes/src/std/lib.rs.html). cc ```@jsha``` r? ```@notriddle```
Diffstat (limited to 'src/test/rustdoc-gui')
| -rw-r--r-- | src/test/rustdoc-gui/sidebar-source-code-display.goml | 36 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/sidebar-source-code.goml | 4 |
2 files changed, 38 insertions, 2 deletions
diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index 8f53e8627ee..c441f84a821 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -116,3 +116,39 @@ assert-css: ( "#source-sidebar .expand + .children .folders .name", {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, ) + +// Now checking on mobile devices. +size: (500, 700) +reload: +// Waiting for the sidebar to be displayed... +wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) + +// We now check it takes the full size of the display. +assert-property: ("body", {"clientWidth": "500", "clientHeight": "700"}) +assert-property: (".sidebar", {"clientWidth": "500", "clientHeight": "700"}) + +// We now check the display of the toggle once the sidebar is expanded. +assert-property: ("#sidebar-toggle", {"clientWidth": "500", "clientHeight": "39"}) +assert-css: ( + "#sidebar-toggle", + { + "border-top-width": "0px", + "border-right-width": "0px", + "border-left-width": "0px", + "border-bottom-width": "1px", + }, +) + +// We now check that the scroll position is kept when opening the sidebar. +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "0px"}) +// We scroll to line 117 to change the scroll position. +scroll-to: '//*[@id="117"]' +assert-window-property: {"pageYOffset": "2519"} +// Expanding the sidebar... +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "500px"}) +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "0px"}) +// The "scrollTop" property should be the same. +assert-window-property: {"pageYOffset": "2519"} diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 724520bc399..86df478fa1d 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -18,8 +18,8 @@ assert: "nav.sidebar" // We now switch to mobile mode. size: (600, 600) -// We check that the sidebar has the expected width (0 and 1px for the border). -assert-css: ("nav.sidebar", {"width": "1px"}) +// We check that the sidebar has the expected width (0). +assert-css: ("nav.sidebar", {"width": "0px"}) // We expand the sidebar. click: "#sidebar-toggle" assert-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"}) |
