]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/source-code-page.goml
Auto merge of #101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr
[rust.git] / src / test / rustdoc-gui / source-code-page.goml
1 // Checks that the interactions with the source code pages are working as expected.
2 goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
3 // Check that we can click on the line number.
4 click: ".line-numbers > span:nth-child(4)" // This is the span for line 4.
5 // Ensure that the page URL was updated.
6 assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH)
7 assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
8 // We now check that the good spans are highlighted
9 goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
10 assert-attribute-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
11 assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
12 assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
13 assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
14 assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
15 // This is to ensure that the content is correctly align with the line numbers.
16 compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
17
18 // Assert that the line numbers text is aligned to the right.
19 assert-css: (".line-numbers", {"text-align": "right"})
20
21 // Now let's check that clicking on something else than the line number doesn't
22 // do anything (and certainly not add a `#NaN` to the URL!).
23 show-text: true
24 goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
25 // We use this assert-position to know where we will click.
26 assert-position: ("//*[@id='1']", {"x": 104, "y": 103})
27 // We click on the left of the "1" span but still in the "line-number" `<pre>`.
28 click: (103, 103)
29 assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
30
31 // Checking the source code sidebar.
32
33 // First we "open" it.
34 click: "#sidebar-toggle"
35 assert: ".source-sidebar-expanded"
36
37 // We check that the first entry of the sidebar is collapsed
38 assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
39 assert-text: ("#source-sidebar details:first-of-type > summary", "implementors")
40 // We now click on it.
41 click: "#source-sidebar details:first-of-type > summary"
42 assert-property: ("#source-sidebar details:first-of-type", {"open": "true"})
43
44 // And now we collapse it again.
45 click: "#source-sidebar details:first-of-type > summary"
46 assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
47
48 // Check the spacing.
49 assert-css: ("#source-sidebar > details.dir-entry", {"padding-left": "4px"})