2022-01-21 20:41:47 +01:00
|
|
|
// Checks that the interactions with the source code pages are workined as expected.
|
2021-05-02 16:50:14 +02:00
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
|
2021-05-10 14:12:00 +02:00
|
|
|
// Check that we can click on the line number.
|
2021-11-29 15:55:05 +01:00
|
|
|
click: ".line-numbers > span:nth-child(4)" // This is the span for line 4.
|
2022-05-30 17:07:21 +02:00
|
|
|
// Ensure that the page URL was updated.
|
2022-05-30 17:14:46 +02:00
|
|
|
assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH)
|
2022-05-30 17:07:21 +02:00
|
|
|
assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
|
2021-05-10 14:12:00 +02:00
|
|
|
// We now check that the good spans are highlighted
|
2021-05-02 16:50:14 +02:00
|
|
|
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
|
2021-06-22 11:11:45 +02:00
|
|
|
assert-attribute-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
|
|
|
|
|
assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
|
|
|
|
assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
|
|
|
|
|
assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
|
|
|
|
|
assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
|
2021-06-22 11:17:53 +02:00
|
|
|
// This is to ensure that the content is correctly align with the line numbers.
|
2021-08-16 23:19:00 +02:00
|
|
|
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
|
2022-03-07 12:08:14 +01:00
|
|
|
|
|
|
|
|
// Assert that the line numbers text is aligned to the right.
|
|
|
|
|
assert-css: (".line-numbers", {"text-align": "right"})
|
2022-05-30 17:14:46 +02: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})
|
|
|
|
|
// We click on the left of the "1" span but still in the "line-number" `<pre>`.
|
|
|
|
|
click: (103, 103)
|
|
|
|
|
assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
|