diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-29 21:26:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-29 21:26:11 +0200 |
| commit | 9aedec9313dc8ecf9bdcb5f09c4eb0ad8b9a4875 (patch) | |
| tree | b9d4fc3ae4b3abc11c5a9dadf910dcd41c5fb660 /tests/rustdoc-gui/sidebar-source-code.goml | |
| parent | 66e5852c3bd022e2a589a089a0bc8392f8b291e1 (diff) | |
| parent | ac303df4e21eabfbf692f2d1959f7403f4887a31 (diff) | |
| download | rust-9aedec9313dc8ecf9bdcb5f09c4eb0ad8b9a4875.tar.gz rust-9aedec9313dc8ecf9bdcb5f09c4eb0ad8b9a4875.zip | |
Rollup merge of #126247 - notriddle:notriddle/word-wrap-item-table, r=GuillaumeGomez
rustdoc: word wrap CamelCase in the item list table and sidebar This is an alternative to https://github.com/rust-lang/rust/pull/126209. That is, it fixes the issue that affects the very long type names in https://docs.rs/async-stripe/0.31.0/stripe/index.html#structs. This is, necessarily, a pile of nasty heuristics. We need to balance a few issues: - Sometimes, there's no real word break. For example, `BTreeMap` should be `BTree<wbr>Map`, not `B<wbr>Tree<wbr>Map`. - Sometimes, there's a legit word break, but the name is tiny and the HTML overhead isn't worth it. For example, if we're typesetting `TyCtx`, writing `Ty<wbr>Ctx` would have an HTML overhead of 50%. Line breaking inside it makes no sense. # Screenshots | Before | After | | ------ | ----- | |  | 
Diffstat (limited to 'tests/rustdoc-gui/sidebar-source-code.goml')
| -rw-r--r-- | tests/rustdoc-gui/sidebar-source-code.goml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index ef0b5ab38b1..6afccf6a95f 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -66,12 +66,12 @@ click: "#sidebar-button" // We wait for the sidebar to be expanded. wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"}) assert: "//*[@class='dir-entry' and @open]/*[text()='lib2']" -assert: "//*[@class='dir-entry' and @open]/*[text()='another_folder']" -assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']" +assert: "//*[@class='dir-entry' and @open]/*[normalize-space()='another_folder']" +assert: "//*[@class='dir-entry' and @open]/*[normalize-space()='sub_mod']" // Only "another_folder" should be "open" in "lib2". -assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']" +assert: "//*[@class='dir-entry' and not(@open)]/*[normalize-space()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 11) +assert-count: ("//*[@id='src-sidebar']/details[not(normalize-space()='lib2') and not(@open)]", 11) // We now switch to mobile mode. set-window-size: (600, 600) |
