]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/source-anchor-scroll.goml
Rollup merge of #107740 - oli-obk:lock_tcx, r=petrochenkov
[rust.git] / tests / rustdoc-gui / source-anchor-scroll.goml
1 // We check that when the anchor changes and is output of the displayed content,
2 // the page is scrolled to it.
3 goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
4
5 // We reduce the window size to make it easier to make an element "out of the page".
6 size: (600, 800)
7 // We check that the scroll is at the top first.
8 assert-property: ("html", {"scrollTop": "0"})
9
10 click: '//a[text() = "barbar"]'
11 assert-property: ("html", {"scrollTop": "125"})
12 click: '//a[text() = "bar"]'
13 assert-property: ("html", {"scrollTop": "156"})
14 click: '//a[text() = "sub_fn"]'
15 assert-property: ("html", {"scrollTop": "53"})
16
17 // We now check that clicking on lines doesn't change the scroll
18 // Extra information: the "sub_fn" function header is on line 1.
19 click: '//*[@id="6"]'
20 assert-property: ("html", {"scrollTop": "53"})