diff options
| author | Michael Howell <michael@notriddle.com> | 2022-10-14 09:48:19 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-10-15 11:38:42 -0700 |
| commit | ae4ad9adb68c9935cb3a9d119ba61648e786d4b4 (patch) | |
| tree | 65a2c095e711eebe3544d5abddf32a83d1884956 /src/test | |
| parent | ee1c3b385b6673b6ef37d80dfabe048e993c2ae2 (diff) | |
| download | rust-ae4ad9adb68c9935cb3a9d119ba61648e786d4b4.tar.gz rust-ae4ad9adb68c9935cb3a9d119ba61648e786d4b4.zip | |
rustdoc: make the help button a link to a page
This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-gui/help-page.goml | 24 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/search-form-elements.goml | 16 |
2 files changed, 32 insertions, 8 deletions
diff --git a/src/test/rustdoc-gui/help-page.goml b/src/test/rustdoc-gui/help-page.goml new file mode 100644 index 00000000000..51f089cce74 --- /dev/null +++ b/src/test/rustdoc-gui/help-page.goml @@ -0,0 +1,24 @@ +// This test ensures that opening the help page in its own tab works. +goto: "file://" + |DOC_PATH| + "/help.html" +size: (1000, 1000) // Try desktop size first. +wait-for: "#help" +assert-css: ("#help", {"display": "block"}) +click: "#help-button > a" +assert-css: ("#help", {"display": "block"}) +compare-elements-property: (".sub-container", "#help", ["offsetWidth"]) +compare-elements-position: (".sub-container", "#help", ("x")) +size: (500, 1000) // Try mobile next. +assert-css: ("#help", {"display": "block"}) +compare-elements-property: (".sub-container", "#help", ["offsetWidth"]) +compare-elements-position: (".sub-container", "#help", ("x")) + +// This test ensures that opening the help popover without switching pages works. +goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +size: (1000, 1000) // Only supported on desktop. +assert-false: "#help" +click: "#help-button > a" +assert-css: ("#help", {"display": "block"}) +click: "#help-button > a" +assert-css: ("#help", {"display": "none"}) +compare-elements-property-false: (".sub-container", "#help", ["offsetWidth"]) +compare-elements-position-false: (".sub-container", "#help", ("x")) diff --git a/src/test/rustdoc-gui/search-form-elements.goml b/src/test/rustdoc-gui/search-form-elements.goml index fba9cc8777f..0bc8f44c74d 100644 --- a/src/test/rustdoc-gui/search-form-elements.goml +++ b/src/test/rustdoc-gui/search-form-elements.goml @@ -33,7 +33,7 @@ assert-css: ( {"border-color": "rgb(197, 197, 197)"}, ) assert-css: ( - "#help-button > button", + "#help-button > a", { "color": "rgb(255, 255, 255)", "border-color": "rgb(92, 103, 115)", @@ -47,7 +47,7 @@ assert-css: ( ) // Only "border-color" should change. assert-css: ( - "#help-button:hover > button", + "#help-button:hover > a", { "color": "rgb(255, 255, 255)", "border-color": "rgb(224, 224, 224)", @@ -113,7 +113,7 @@ assert-css: ( {"border-color": "rgb(221, 221, 221)"}, ) assert-css: ( - "#help-button > button", + "#help-button > a", { "color": "rgb(0, 0, 0)", "border-color": "rgb(224, 224, 224)", @@ -127,7 +127,7 @@ assert-css: ( ) // Only "border-color" should change. assert-css: ( - "#help-button:hover > button", + "#help-button:hover > a", { "color": "rgb(0, 0, 0)", "border-color": "rgb(255, 185, 0)", @@ -193,7 +193,7 @@ assert-css: ( {"border-color": "rgb(0, 0, 0)"}, ) assert-css: ( - "#help-button > button", + "#help-button > a", { "color": "rgb(0, 0, 0)", "border-color": "rgb(224, 224, 224)", @@ -207,7 +207,7 @@ assert-css: ( ) // Only "border-color" should change. assert-css: ( - "#help-button:hover > button", + "#help-button:hover > a", { "color": "rgb(0, 0, 0)", "border-color": "rgb(113, 113, 113)", @@ -222,7 +222,7 @@ assert-css: ( assert-css: ( "#settings-menu > a", { - "color": "rgb(56, 115, 173)", + "color": "rgb(0, 0, 0)", "border-color": "rgb(224, 224, 224)", "background-color": "rgb(255, 255, 255)", }, @@ -236,7 +236,7 @@ assert-css: ( assert-css: ( "#settings-menu:hover > a", { - "color": "rgb(56, 115, 173)", + "color": "rgb(0, 0, 0)", "border-color": "rgb(113, 113, 113)", "background-color": "rgb(255, 255, 255)", }, |
