Skip to content

Commit

Permalink
Add regression test for rust-lang#120471 to ensure that long crate na…
Browse files Browse the repository at this point in the history
…me are handled as expected on mobile
  • Loading branch information
GuillaumeGomez committed Jan 31, 2024
1 parent d907a6b commit 5d29f5a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions tests/rustdoc-gui/mobile-crate-name.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Checks that if the crate name is too long on mobile, it will not grow and overflow its parent
// (thanks to text overflow ellipsis).

go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// First we change the title to make it big.
set-window-size: (350, 800)
// We ensure that the "format" of the title is the same as the one we'll use.
assert-text: (".mobile-topbar .location a", "test_docs")
// We store the height we know is correct.
store-property: (".mobile-topbar .location", {"offsetHeight": height})
// We change the crate name to something longer.
set-text: (".mobile-topbar .location a", "cargo_packager_resource_resolver")
// And we check that the size remained the same.
assert-property: (".mobile-topbar .location", {"offsetHeight": |height|})

// Now we check if it works for the non-crate pages as well.
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// We store the height we know is correct.
store-property: (".mobile-topbar .location", {"offsetHeight": height})
set-text: (".mobile-topbar .location a", "Something_incredibly_long_because")
// And we check that the size remained the same.
assert-property: (".mobile-topbar .location", {"offsetHeight": |height|})
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ assert-property: ("pre.item-decl", {"scrollWidth": "950"})
set-window-size: (600, 600)
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
// It shouldn't have an overflow in the topbar either.
store-property: (".mobile-topbar h2", {"scrollWidth": scrollWidth})
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
store-property: (".mobile-topbar", {"scrollWidth": scrollWidth})
assert-property: (".mobile-topbar", {"clientWidth": |scrollWidth|})
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})

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

0 comments on commit 5d29f5a

Please sign in to comment.