]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/type-declation-overflow.goml
Rollup merge of #106477 - Nathan-Fenner:nathanf/refined-error-span-trait-impl, r...
[rust.git] / tests / rustdoc-gui / type-declation-overflow.goml
1 // ignore-tidy-linelength
2 // This test ensures that the items declaration content overflow is handled inside the <pre> directly.
3
4 // We need to disable this check because
5 // `implementors/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
6 // doesn't exist.
7 fail-on-request-error: false
8
9 goto: "file://" + |DOC_PATH| + "/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html"
10 // We set a fixed size so there is no chance of "random" resize.
11 size: (1100, 800)
12 // Logically, the <body> scroll width should be the width of the window.
13 assert-property: ("body", {"scrollWidth": "1100"})
14 // However, since there is overflow in the type declaration, its scroll width is bigger.
15 assert-property: ("pre.item-decl", {"scrollWidth": "1324"})
16
17 // In the table-ish view on the module index, the name should not be wrapped more than necessary.
18 goto: "file://" + |DOC_PATH| + "/lib2/too_long/index.html"
19 assert-property: (".item-table .struct", {"offsetWidth": "684"})
20
21 // We now make the same check on type declaration...
22 goto: "file://" + |DOC_PATH| + "/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html"
23 assert-property: ("body", {"scrollWidth": "1100"})
24 // We now check that the section width hasn't grown because of it.
25 assert-property: ("#main-content", {"scrollWidth": "840"})
26 // And now checking that it has scrollable content.
27 assert-property: ("pre.item-decl", {"scrollWidth": "1103"})
28
29 // ... and constant.
30 // On a sidenote, it also checks that the (very) long title isn't changing the docblock width.
31 goto: "file://" + |DOC_PATH| + "/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html"
32 assert-property: ("body", {"scrollWidth": "1100"})
33 // We now check that the section width hasn't grown because of it.
34 assert-property: ("#main-content", {"scrollWidth": "840"})
35 // And now checking that it has scrollable content.
36 assert-property: ("pre.item-decl", {"scrollWidth": "950"})
37
38 // On mobile:
39 size: (600, 600)
40 goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
41 // It shouldn't have an overflow in the topbar either.
42 store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
43 assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
44 assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
45
46 // Check wrapping for top main-heading h1 and out-of-band.
47 // On desktop, they wrap when too big.
48 size: (1100, 800)
49 goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
50 compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
51 goto: "file://" + |DOC_PATH| + "/lib2/index.html"
52 compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y"))
53 // make sure there is a gap between them
54 compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550})
55
56 // On mobile, they always wrap.
57 size: (600, 600)
58 goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
59 compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
60 goto: "file://" + |DOC_PATH| + "/lib2/index.html"
61 compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
62
63 // Now we will check that the scrolling is working.
64 // First on an item with "hidden methods".
65 goto: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html"
66
67 click: ".item-decl .type-contents-toggle"
68 assert-property: ("pre.item-decl", {"scrollLeft": 0})
69 scroll-to: "//*[@class='rust item-decl']//details/a[text()='String']"
70 assert-property-false: ("pre.item-decl", {"scrollLeft": 0})
71
72 // Then on an item without "hidden methods".
73 goto: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.TraitWithLongItemsName.html"
74 assert-property: ("pre.item-decl", {"scrollLeft": 0})
75 scroll-to: "//*[@class='rust item-decl']//code/a[text()='String']"
76 assert-property-false: ("pre.item-decl", {"scrollLeft": 0})