2022-06-14 04:21:28 -05:00
|
|
|
// Checks that the interactions with the source code pages are working as expected.
|
2021-05-02 09:50:14 -05:00
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
|
2021-05-10 07:12:00 -05:00
|
|
|
// Check that we can click on the line number.
|
2022-09-26 12:50:51 -05:00
|
|
|
click: ".src-line-numbers > span:nth-child(4)" // This is the span for line 4.
|
2022-05-30 10:07:21 -05:00
|
|
|
// Ensure that the page URL was updated.
|
2022-05-30 10:14:46 -05:00
|
|
|
assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH)
|
2022-05-30 10:07:21 -05:00
|
|
|
assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
|
2021-05-10 07:12:00 -05:00
|
|
|
// We now check that the good spans are highlighted
|
2021-05-02 09:50:14 -05:00
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
|
2022-09-26 12:50:51 -05:00
|
|
|
assert-attribute-false: (".src-line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
|
|
|
|
assert-attribute: (".src-line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
|
|
|
assert-attribute: (".src-line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
|
|
|
|
assert-attribute: (".src-line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
|
|
|
|
assert-attribute-false: (".src-line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
|
2021-06-22 04:17:53 -05:00
|
|
|
// This is to ensure that the content is correctly align with the line numbers.
|
2021-08-16 16:19:00 -05:00
|
|
|
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
|
2022-03-07 05:08:14 -06:00
|
|
|
|
|
|
|
// Assert that the line numbers text is aligned to the right.
|
2022-09-26 12:50:51 -05:00
|
|
|
assert-css: (".src-line-numbers", {"text-align": "right"})
|
2022-05-30 10:14:46 -05:00
|
|
|
|
|
|
|
// Now let's check that clicking on something else than the line number doesn't
|
|
|
|
// do anything (and certainly not add a `#NaN` to the URL!).
|
|
|
|
show-text: true
|
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
|
|
|
|
// We use this assert-position to know where we will click.
|
|
|
|
assert-position: ("//*[@id='1']", {"x": 104, "y": 103})
|
2022-09-26 12:50:51 -05:00
|
|
|
// We click on the left of the "1" span but still in the "src-line-number" `<pre>`.
|
2022-05-30 10:14:46 -05:00
|
|
|
click: (103, 103)
|
|
|
|
assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
|
2022-06-14 04:21:28 -05:00
|
|
|
|
|
|
|
// Checking the source code sidebar.
|
|
|
|
|
|
|
|
// First we "open" it.
|
|
|
|
click: "#sidebar-toggle"
|
2022-06-20 14:41:11 -05:00
|
|
|
assert: ".source-sidebar-expanded"
|
2022-06-14 04:21:28 -05:00
|
|
|
|
2022-07-01 12:33:06 -05:00
|
|
|
// We check that the first entry of the sidebar is collapsed
|
|
|
|
assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
|
|
|
|
assert-text: ("#source-sidebar details:first-of-type > summary", "implementors")
|
2022-06-14 04:21:28 -05:00
|
|
|
// We now click on it.
|
2022-07-01 12:33:06 -05:00
|
|
|
click: "#source-sidebar details:first-of-type > summary"
|
|
|
|
assert-property: ("#source-sidebar details:first-of-type", {"open": "true"})
|
2022-06-14 04:21:28 -05:00
|
|
|
|
|
|
|
// And now we collapse it again.
|
2022-07-01 12:33:06 -05:00
|
|
|
click: "#source-sidebar details:first-of-type > summary"
|
|
|
|
assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
|
2022-07-02 11:42:49 -05:00
|
|
|
|
|
|
|
// Check the spacing.
|
|
|
|
assert-css: ("#source-sidebar > details.dir-entry", {"padding-left": "4px"})
|