2021-07-10 21:10:14 +02:00
|
|
|
// The goal of this test is to check that the external trait implementors, generated with JS,
|
|
|
|
// have the same display than the "local" ones.
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html"
|
2021-07-10 21:10:14 +02:00
|
|
|
assert: "#implementors-list"
|
|
|
|
// There are supposed to be two implementors listed.
|
2021-08-30 16:47:17 +02:00
|
|
|
assert-count: ("#implementors-list .impl", 2)
|
2021-07-10 21:10:14 +02:00
|
|
|
// Now we check that both implementors have an anchor, an ID and a similar DOM.
|
2021-08-30 16:47:17 +02:00
|
|
|
assert: ("#implementors-list .impl:nth-child(1) > a.anchor")
|
2022-01-10 15:35:55 -06:00
|
|
|
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever-for-Struct"})
|
|
|
|
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever-for-Struct"})
|
2022-09-25 13:09:22 -07:00
|
|
|
assert: "#implementors-list .impl:nth-child(1) > .code-header"
|
2021-07-10 21:10:14 +02:00
|
|
|
|
2021-08-30 16:47:17 +02:00
|
|
|
assert: ("#implementors-list .impl:nth-child(2) > a.anchor")
|
|
|
|
assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"})
|
|
|
|
assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
|
2022-09-25 13:09:22 -07:00
|
|
|
assert: "#implementors-list .impl:nth-child(2) > .code-header"
|
2022-02-07 22:36:51 -08:00
|
|
|
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html"
|
2022-07-05 15:10:12 +02:00
|
|
|
compare-elements-position-near-false: (
|
|
|
|
"#impl-EmptyTrait1-for-HasEmptyTraits",
|
|
|
|
"#impl-EmptyTrait2-for-HasEmptyTraits",
|
2022-09-25 14:58:49 -07:00
|
|
|
{"y": 34},
|
2022-07-05 15:10:12 +02:00
|
|
|
)
|
|
|
|
compare-elements-position-near: (
|
|
|
|
"#impl-EmptyTrait3-for-HasEmptyTraits h3",
|
|
|
|
"#impl-EmptyTrait3-for-HasEmptyTraits .item-info",
|
2022-09-25 14:58:49 -07:00
|
|
|
{"y": 34},
|
2022-07-05 15:10:12 +02:00
|
|
|
)
|
2022-05-05 17:20:14 -07:00
|
|
|
|
|
|
|
// Now check that re-exports work correctly.
|
|
|
|
// There should be exactly one impl shown on both of these pages.
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html"
|
2022-05-05 17:20:14 -07:00
|
|
|
assert-count: ("#implementors-list .impl", 1)
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html"
|
2022-05-06 05:18:32 -07:00
|
|
|
assert-count: ("#implementors-list .impl", 1)
|
2023-01-03 19:46:40 -07:00
|
|
|
|
|
|
|
// Now check that the link is properly rewritten for a crate called `http`.
|
|
|
|
// An older version of rustdoc had a buggy check for absolute links.
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/http/trait.HttpTrait.html"
|
2023-01-03 19:46:40 -07:00
|
|
|
assert-count: ("#implementors-list .impl", 1)
|
|
|
|
assert-attribute: ("#implementors-list .impl a.trait", {"href": "../http/trait.HttpTrait.html"})
|