From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/rustdoc-gui/sidebar-mobile.goml | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/test/rustdoc-gui/sidebar-mobile.goml (limited to 'src/test/rustdoc-gui/sidebar-mobile.goml') diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml new file mode 100644 index 000000000..033c65783 --- /dev/null +++ b/src/test/rustdoc-gui/sidebar-mobile.goml @@ -0,0 +1,64 @@ +// This test ensure that the sidebar isn't "hidden" on mobile but instead moved out of the viewport. +// This is especially important for devices for "text-first" content (like for users with +// sight issues). +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +// Switching to "mobile view" by reducing the width to 600px. +size: (600, 600) +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) +// Opening the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"display": "block", "left": "0px"}) +// Closing the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) +// Force the sidebar open by focusing a link inside it. +// This makes it easier for keyboard users to get to it. +focus: ".sidebar-title a" +assert-css: (".sidebar", {"display": "block", "left": "0px"}) +// When we tab out of the sidebar, close it. +focus: ".search-input" +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) + +// Open the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"left": "0px"}) + +// Click elsewhere. +click: "body" +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) + +// Check that the topbar is visible +assert-property: (".mobile-topbar", {"clientHeight": "45"}) + +// Check that clicking an element from the sidebar scrolls to the right place +// so the target is not obscured by the topbar. +click: ".sidebar-menu-toggle" +click: ".sidebar-elems section .block li > a" +assert-position: ("#method\.must_use", {"y": 45}) + +// Check that the bottom-most item on the sidebar menu can be scrolled fully into view. +click: ".sidebar-menu-toggle" +scroll-to: ".block.keyword li:nth-child(1)" +compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543}) + +// Now checking the background color of the sidebar. +local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"} +reload: + +// Open the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"background-color": "rgb(80, 80, 80)"}) + +local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "ayu"} +reload: + +// Open the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"background-color": "rgb(20, 25, 31)"}) + +local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "light"} +reload: + +// Open the sidebar menu. +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"background-color": "rgb(245, 245, 245)"}) -- cgit v1.2.3