Skip to content

Commit de6163f

Browse files
Add regression test for rust-lang#120471 to ensure that long crate name are handled as expected on mobile
1 parent 9e5247b commit de6163f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Checks that if the crate name is too long on mobile, it will not grow and overflow its parent
2+
// (thanks to text overflow ellipsis).
3+
4+
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
5+
// First we change the title to make it big.
6+
set-window-size: (350, 800)
7+
// We ensure that the "format" of the title is the same as the one we'll use.
8+
assert-text: (".mobile-topbar .location", "Crate test_docs")
9+
// We store the height we know is correct.
10+
store-property: (".mobile-topbar .location", {"offsetHeight": height})
11+
// We change the crate name to something longer.
12+
set-text: (".mobile-topbar .location", "Crate cargo_packager_resource_resolver")
13+
// And we check that the size remained the same.
14+
assert-property: (".mobile-topbar .location", {"offsetHeight": |height|})
15+
16+
// Now we check if it works for the non-crate pages as well.
17+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
18+
// We store the height we know is correct.
19+
store-property: (".mobile-topbar .location", {"offsetHeight": height})
20+
// We change the crate name to something longer (we need to change the link text here).
21+
set-text: (".mobile-topbar .location a", "Something_incredibly_long_because")
22+
// And we check that the size remained the same.
23+
assert-property: (".mobile-topbar .location", {"offsetHeight": |height|})

tests/rustdoc-gui/type-declation-overflow.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ assert-property: ("pre.item-decl", {"scrollWidth": "950"})
3939
set-window-size: (600, 600)
4040
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
4141
// It shouldn't have an overflow in the topbar either.
42-
store-property: (".mobile-topbar h2", {"scrollWidth": scrollWidth})
43-
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
42+
store-property: (".mobile-topbar", {"scrollWidth": scrollWidth})
43+
assert-property: (".mobile-topbar", {"clientWidth": |scrollWidth|})
4444
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
4545

4646
// Check wrapping for top main-heading h1 and out-of-band.

0 commit comments

Comments
 (0)