Add check for trait impl method anchor

This commit is contained in:
Guillaume Gomez
2026-01-08 17:41:42 +01:00
parent bfb117ac74
commit 16fbf6a27b
2 changed files with 24 additions and 0 deletions
+16
View File
@@ -45,6 +45,22 @@ define-function: (
{"color": |src_link_color|, "text-decoration": "none"},
)
// Now we ensure that the `§` anchor is "reachable" for users on trait methods.
// To ensure the anchor is not hovered, we move the cursor to another item.
move-cursor-to: "#search-button"
// By default, the anchor is not displayed.
wait-for-css: ("#method\.vroum .anchor", {"display": "none"})
// Once we move the cursor to the method, the anchor should appear.
move-cursor-to: "#method\.vroum .code-header"
assert-css-false: ("#method\.vroum .anchor", {"display": "none"})
// Now we move the cursor to the anchor to check there is no gap between the method and the
// anchor, making the anchor disappear and preventing users to click on it.
// To make it work, we need to first move it between the method and the anchor.
store-position: ("#method\.vroum .code-header", {"x": method_x, "y": method_y})
move-cursor-to: (|method_x| - 2, |method_y|)
// Anchor should still be displayed.
assert-css-false: ("#method\.vroum .anchor", {"display": "none"})
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// Since we changed page, we need to set the theme again.
call-function: ("switch-theme", {"theme": |theme|})
+8
View File
@@ -4,6 +4,10 @@
#![stable(feature = "some_feature", since = "1.3.5")]
#![doc(rust_logo)]
pub trait X {
fn vroum();
}
#[stable(feature = "some_feature", since = "1.3.5")]
pub struct Foo {}
@@ -13,3 +17,7 @@ pub fn bar() {}
#[stable(feature = "some_other_feature", since = "1.3.6")]
pub fn yo() {}
}
impl X for Foo {
fn vroum() {}
}