From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/rustdoc-gui/sidebar.goml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'tests/rustdoc-gui/sidebar.goml') diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index a6d517090..3c1ed009a 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -1,5 +1,5 @@ // Checks multiple things on the sidebar display (width of its elements, colors, etc). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) show-text: true @@ -8,7 +8,7 @@ define-function: ( "check-colors", (theme, color, background_color), block { - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } @@ -46,7 +46,7 @@ call-function: ( } ) -local-storage: {"rustdoc-theme": "light"} +set-local-storage: {"rustdoc-theme": "light"} // We reload the page so the local storage settings are being used. reload: @@ -86,13 +86,13 @@ click: ".sidebar h2.location a" assert-property: ("html", {"scrollTop": "0"}) // We now go back to the crate page to click on the "lib2" crate link. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"}) click: ".sidebar-elems ul.crate > li:first-child > a" // PAGE: lib2/index.html -goto: "file://" + |DOC_PATH| + "/lib2/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Crate lib2") // We check that we have the crates list and that the "current" on is now "lib2". @@ -115,13 +115,13 @@ assert-text: (".sidebar .sidebar-elems h2", "In lib2") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" -goto: "./module/index.html" +go-to: "./module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Module module") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" -goto: "./sub_module/sub_sub_module/index.html" +go-to: "./sub_module/sub_sub_module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Module sub_sub_module") // We check that we don't have the crate list. @@ -130,13 +130,13 @@ assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions") assert-text: ("#functions + .item-table .item-name > a", "foo") // Links to trait implementations in the sidebar should not wrap even if they are long. -goto: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29}) // Test that clicking on of the "In " headings in the sidebar links to the // appropriate anchor in index.html. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-property: (".sidebar", {"clientWidth": "200"}) click: "//ul[@class='block mod']/preceding-sibling::h3/a" // PAGE: index.html @@ -149,3 +149,17 @@ assert-property: (".sidebar", {"clientWidth": "200"}) click: "#toggle-all-docs" assert-text: ("#toggle-all-docs", "[−]") assert-property: (".sidebar", {"clientWidth": "200"}) + +// Checks that all.html and index.html have their sidebar link in the same place. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +store-property: (index_sidebar_width, ".sidebar .location a", "clientWidth") +store-property: (index_sidebar_height, ".sidebar .location a", "clientHeight") +store-property: (index_sidebar_x, ".sidebar .location a", "offsetTop") +store-property: (index_sidebar_y, ".sidebar .location a", "offsetLeft") +go-to: "file://" + |DOC_PATH| + "/test_docs/all.html" +assert-property: (".sidebar .location a", { + "clientWidth": |index_sidebar_width|, + "clientHeight": |index_sidebar_height|, + "offsetTop": |index_sidebar_x|, + "offsetLeft": |index_sidebar_y|, +}) -- cgit v1.2.3