diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-07-15 18:10:50 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-07-15 20:07:24 +0200 |
| commit | 9855a3844bbe96d03f18541bdee3e325c35c8a34 (patch) | |
| tree | 0f0ac9c0ef4f1626a3bc866d8fc85a42d62c123d | |
| parent | a868b3fce74c11e2efc54ed1e9f13894a4bc6381 (diff) | |
| download | rust-9855a3844bbe96d03f18541bdee3e325c35c8a34.tar.gz rust-9855a3844bbe96d03f18541bdee3e325c35c8a34.zip | |
Add tests for new toggle on deref blocks
| -rw-r--r-- | tests/rustdoc-gui/deref-block.goml | 30 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/lib2/lib.rs | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/deref-block.goml b/tests/rustdoc-gui/deref-block.goml new file mode 100644 index 00000000000..24f612f8a6f --- /dev/null +++ b/tests/rustdoc-gui/deref-block.goml @@ -0,0 +1,30 @@ +// This test ensures that several clickable items actually have the pointer cursor. +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Derefer.html" + +assert-text: (".big-toggle summary", "Methods from Deref<Target = str>§") +// We ensure it doesn't go over `§`. +assert-css: (".big-toggle summary::before", { + "left": "-34px", + "top": "9px", +}) +// It should NOT have the same X or Y position as the other toggles. +compare-elements-position-false: ( + ".big-toggle summary::before", + ".method-toggle summary::before", + ["x", "y"], +) + +// We now check that if we're in mobile mode, it gets back to its original X position. +set-window-size: (600, 600) +assert-css: (".big-toggle summary::before", { + "left": "-11px", + "top": "9px", +}) +// It should have the same X position as the other toggles. +compare-elements-position: (".big-toggle summary::before", ".method-toggle summary::before", ["x"]) +// But still shouldn't have the same Y position. +compare-elements-position-false: ( + ".big-toggle summary::before", + ".method-toggle summary::before", + ["y"], +) diff --git a/tests/rustdoc-gui/src/lib2/lib.rs b/tests/rustdoc-gui/src/lib2/lib.rs index b467b044052..fafb8f3b59b 100644 --- a/tests/rustdoc-gui/src/lib2/lib.rs +++ b/tests/rustdoc-gui/src/lib2/lib.rs @@ -355,3 +355,13 @@ pub mod scroll_traits { fn this_is_a_method_with_a_long_name_returning_something() -> String; } } + +pub struct Derefer(String); + +impl std::ops::Deref for Derefer { + type Target = str; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} |
