diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-04-22 00:44:44 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-04-23 21:34:50 +0200 |
| commit | f7d8558003d5821868feef3fe1858fb422a5afc4 (patch) | |
| tree | b622781233e1eed3e025eec41915c760edefb512 | |
| parent | 934e86b24f8eaf9a52b7c7004fc7a02b1c8310f6 (diff) | |
| download | rust-f7d8558003d5821868feef3fe1858fb422a5afc4.tar.gz rust-f7d8558003d5821868feef3fe1858fb422a5afc4.zip | |
Add rustdoc-gui test to ensure sidebars share the same image
| -rw-r--r-- | tests/rustdoc-gui/sidebar.goml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index 38160cc49d0..9c66b84165f 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -199,6 +199,42 @@ assert-position-false: (".sidebar-crate > h2 > a", {"x": -3}) drag-and-drop: ((205, 100), (108, 100)) assert-position: (".sidebar-crate > h2 > a", {"x": -3}) +// Check that the mobile sidebar and the source sidebar use the same icon. +store-css: (".mobile-topbar .sidebar-menu-toggle::before", {"content": image_url}) +// Then we go to a source page. +click: ".main-heading .src" +assert-css: ("#sidebar-button a::before", {"content": |image_url|}) +// Check that hover events work as expected. +store-css: ("#sidebar-button a", {"background-color": sidebar_background}) +move-cursor-to: "#sidebar-button a" +store-css: ("#sidebar-button a:hover", {"background-color": sidebar_background_hover}) +assert: |sidebar_background| != |sidebar_background_hover| +click: "#sidebar-button a" +wait-for: "html.src-sidebar-expanded" +assert-css: ("#sidebar-button a:hover", {"background-color": |sidebar_background_hover|}) +move-cursor-to: "#settings-menu" +assert-css: ("#sidebar-button a:not(:hover)", {"background-color": |sidebar_background|}) +// Closing sidebar. +click: "#sidebar-button a" +wait-for: "html:not(.src-sidebar-expanded)" +// Now we check the same when the sidebar button is moved alongside the search. +set-window-size: (500, 500) +store-css: ("#sidebar-button a:hover", {"background-color": not_sidebar_background_hover}) +move-cursor-to: "#settings-menu" +store-css: ("#sidebar-button a:not(:hover)", {"background-color": not_sidebar_background}) +// The sidebar background is supposed to be the same as the main background. +assert-css: ("body", {"background-color": |not_sidebar_background|}) +assert: |not_sidebar_background| != |not_sidebar_background_hover| && |not_sidebar_background| != |sidebar_background| +// The hover background is supposed to be the same as the sidebar background. +assert: |not_sidebar_background_hover| == |sidebar_background| +click: "#sidebar-button a" +wait-for: "html.src-sidebar-expanded" +// And now the background colors are supposed to be the same as the sidebar since the sidebar has +// been open. +assert-css: ("#sidebar-button a:hover", {"background-color": |sidebar_background_hover|}) +move-cursor-to: "h2" +assert-css: ("#sidebar-button a:not(:hover)", {"background-color": |sidebar_background|}) + // Configuration option to show TOC in sidebar. set-local-storage: {"rustdoc-hide-toc": "true"} go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" |
