|
2 | 2 | // have the same display than the "local" ones.
|
3 | 3 | go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html"
|
4 | 4 | assert: "#implementors-list"
|
5 |
| -// There are supposed to be two implementors listed. |
6 |
| -assert-count: ("#implementors-list .impl", 2) |
| 5 | +// There are supposed to be four implementors listed. |
| 6 | +assert-count: ("#implementors-list .impl", 4) |
| 7 | +// There are supposed to be two non-negative implementors. |
| 8 | +assert-count: ("#implementors-list .negative-marker ~ *", 2) |
7 | 9 | // Now we check that both implementors have an anchor, an ID and a similar DOM.
|
8 |
| -assert: ("#implementors-list .impl:nth-child(1) > a.anchor") |
9 |
| -assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever-for-Struct"}) |
10 |
| -assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever-for-Struct"}) |
11 |
| -assert: "#implementors-list .impl:nth-child(1) > .code-header" |
| 10 | +define-function: ( |
| 11 | + "check-dom", |
| 12 | + [id], |
| 13 | + block { |
| 14 | + assert-attribute: (|id| + " > a.anchor", {"href": |id|}) |
| 15 | + assert: |id| + " > .code-header" |
| 16 | + }, |
| 17 | +) |
| 18 | + |
| 19 | +call-function: ("check-dom", {"id": "#impl-Whatever-for-Struct2"}) |
| 20 | +call-function: ("check-dom", {"id": "#impl-Whatever-2"}) |
| 21 | +call-function: ("check-dom", {"id": "#impl-Whatever-for-Struct"}) |
| 22 | +call-function: ("check-dom", {"id": "#impl-Whatever-3"}) |
12 | 23 |
|
13 |
| -assert: ("#implementors-list .impl:nth-child(2) > a.anchor") |
14 |
| -assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"}) |
15 |
| -assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) |
16 |
| -assert: "#implementors-list .impl:nth-child(2) > .code-header" |
| 24 | +// Ensure that negative impl are sorted first. |
| 25 | +assert-property: ( |
| 26 | + "#implementors-list > *:nth-child(1) > h3", |
| 27 | + {"textContent": "impl !Whatever for Struct2"}, |
| 28 | +) |
| 29 | +assert-property: ( |
| 30 | + "#implementors-list > *:nth-child(2) > h3", |
| 31 | + {"textContent": "impl !Whatever for StructToImplOnReexport"}, |
| 32 | +) |
| 33 | +// Third one is the negative marker. |
| 34 | +assert-attribute: ("#implementors-list > *:nth-child(3)", {"class": "negative-marker"}) |
| 35 | +// This one is a `<detail>` so the selector is a bit different. |
| 36 | +assert-property: ( |
| 37 | + "#implementors-list > *:nth-child(4) section > h3", |
| 38 | + {"textContent": "impl Whatever for Struct"}, |
| 39 | +) |
| 40 | +assert-property: ( |
| 41 | + "#implementors-list > *:nth-child(5) > h3", |
| 42 | + {"textContent": "impl Whatever for Foo"}, |
| 43 | +) |
17 | 44 |
|
18 | 45 | go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html"
|
19 | 46 | compare-elements-position-near-false: (
|
|
0 commit comments