|
| 1 | +// This test ensures that a bang macro which is also an attribute macro is listed correctly in |
| 2 | +// the sidebar and in the module. |
| 3 | + |
| 4 | +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.b.html" |
| 5 | +// It should be present twice in the sidebar. |
| 6 | +assert-count: ("#rustdoc-modnav a[href='macro.attr_macro.html']", 2) |
| 7 | +assert-count: ("//*[@id='rustdoc-modnav']//a[text()='attr_macro']", 2) |
| 8 | +// We check that the current item in the sidebar is the correct one. |
| 9 | +assert-text: ("#rustdoc-modnav .block.macro .current", "b") |
| 10 | + |
| 11 | +// We now go to the attribute macro page. |
| 12 | +click: "#rustdoc-modnav a[href='macro.attr_macro.html']" |
| 13 | +// It should be present twice in the sidebar. |
| 14 | +assert-count: ("#rustdoc-modnav a[href='macro.attr_macro.html']", 2) |
| 15 | +assert-count: ("//*[@id='rustdoc-modnav']//a[text()='attr_macro']", 2) |
| 16 | +// We check that the current item is the "attr_macro". |
| 17 | +assert-text: ("#rustdoc-modnav .block.macro .current", "attr_macro") |
| 18 | +// Since the item is present twice in the sidebar, we should have two "current" items. |
| 19 | +assert-count: ("#rustdoc-modnav .current", 2) |
| 20 | +// We check it has the expected information. |
| 21 | +assert-text: ("h3.macro-info", "ⓘ This is an attribute/function macro") |
| 22 | + |
| 23 | +// Now we check it's correctly listed in the crate page. |
| 24 | +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" |
| 25 | +// It should be only present twice. |
| 26 | +assert-count: ("#main-content a[href='macro.attr_macro.html']", 2) |
| 27 | +// First in the "Macros" section. |
| 28 | +assert-text: ("#macros + .item-table a[href='macro.attr_macro.html']", "attr_macro") |
| 29 | +// Then in the "Attribute Macros" section. |
| 30 | +assert-text: ("#attributes + .item-table a[href='macro.attr_macro.html']", "attr_macro") |
| 31 | + |
| 32 | +// And finally we check it's correctly listed in the "all items" page. |
| 33 | +go-to: "file://" + |DOC_PATH| + "/test_docs/all.html" |
| 34 | +// It should be only present twice. |
| 35 | +assert-count: ("#main-content a[href='macro.attr_macro.html']", 2) |
| 36 | +// First in the "Macros" section. |
| 37 | +assert-text: ("#macros + .all-items a[href='macro.attr_macro.html']", "attr_macro") |
| 38 | +// Then in the "Attribute Macros" section. |
| 39 | +assert-text: ("#attributes + .all-items a[href='macro.attr_macro.html']", "attr_macro") |
0 commit comments