2023-01-08 14:29:57 -06:00
|
|
|
// ignore-tidy-linelength
|
2021-10-18 09:15:09 -05:00
|
|
|
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
|
2022-11-09 10:00:05 -06:00
|
|
|
|
|
|
|
// We need to disable this check because
|
2023-10-05 20:44:40 -05:00
|
|
|
// `trait.impl/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
|
2022-11-09 10:00:05 -06:00
|
|
|
// doesn't exist.
|
|
|
|
fail-on-request-error: false
|
|
|
|
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html"
|
2021-07-15 11:19:25 -05:00
|
|
|
// We set a fixed size so there is no chance of "random" resize.
|
2024-07-19 11:32:11 -05:00
|
|
|
set-window-size: (710, 800)
|
2021-07-15 11:19:25 -05:00
|
|
|
// Logically, the <body> scroll width should be the width of the window.
|
2024-07-19 11:32:11 -05:00
|
|
|
assert-property: ("body", {"scrollWidth": "710"})
|
|
|
|
// We now check that the section width hasn't grown because of it.
|
|
|
|
assert-property: ("#main-content", {"scrollWidth": "450"})
|
|
|
|
// However, since there is overflow in the type declaration, its scroll width is bigger that "#main-content".
|
|
|
|
assert-property: ("pre.item-decl", {"scrollWidth": "585"})
|
2021-10-18 09:15:09 -05:00
|
|
|
|
2022-01-20 16:47:26 -06:00
|
|
|
// In the table-ish view on the module index, the name should not be wrapped more than necessary.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/index.html"
|
2024-07-18 13:48:10 -05:00
|
|
|
|
|
|
|
// We'll ensure that items with short documentation have the same width.
|
|
|
|
store-property: ("//*[@class='item-table']//*[@class='struct']/..", {"offsetWidth": offset_width})
|
2024-07-19 11:32:11 -05:00
|
|
|
assert: |offset_width| == "149"
|
2024-07-18 13:48:10 -05:00
|
|
|
assert-property: ("//*[@class='item-table']//*[@class='constant']/..", {"offsetWidth": |offset_width|})
|
2022-01-20 16:47:26 -06:00
|
|
|
|
2021-10-18 09:15:09 -05:00
|
|
|
// We now make the same check on type declaration...
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html"
|
2024-07-19 11:32:11 -05:00
|
|
|
assert-property: ("body", {"scrollWidth": "710"})
|
|
|
|
// Getting the width of the "<main>" element.
|
|
|
|
assert-property: ("main", {"scrollWidth": "510"})
|
2021-10-18 09:15:09 -05:00
|
|
|
// We now check that the section width hasn't grown because of it.
|
2024-07-19 11:32:11 -05:00
|
|
|
assert-property: ("#main-content", {"scrollWidth": "450"})
|
2021-10-18 09:15:09 -05:00
|
|
|
// And now checking that it has scrollable content.
|
2023-01-30 12:05:12 -06:00
|
|
|
assert-property: ("pre.item-decl", {"scrollWidth": "1103"})
|
2021-10-18 09:15:09 -05:00
|
|
|
|
|
|
|
// ... and constant.
|
|
|
|
// On a sidenote, it also checks that the (very) long title isn't changing the docblock width.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html"
|
2024-07-19 11:32:11 -05:00
|
|
|
assert-property: ("body", {"scrollWidth": "710"})
|
2021-10-18 09:15:09 -05:00
|
|
|
// We now check that the section width hasn't grown because of it.
|
2024-07-19 11:32:11 -05:00
|
|
|
assert-property: ("#main-content", {"scrollWidth": "450"})
|
2021-10-18 09:15:09 -05:00
|
|
|
// And now checking that it has scrollable content.
|
2023-01-30 12:05:12 -06:00
|
|
|
assert-property: ("pre.item-decl", {"scrollWidth": "950"})
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
|
|
|
|
// On mobile:
|
2023-04-11 12:11:34 -05:00
|
|
|
set-window-size: (600, 600)
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
|
2022-02-04 04:11:03 -06:00
|
|
|
// It shouldn't have an overflow in the topbar either.
|
2024-01-31 07:35:03 -06:00
|
|
|
store-property: (".mobile-topbar", {"scrollWidth": scrollWidth})
|
|
|
|
assert-property: (".mobile-topbar", {"clientWidth": |scrollWidth|})
|
2022-10-18 13:14:01 -05:00
|
|
|
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
|
2022-11-14 16:27:04 -06:00
|
|
|
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
// Check that main heading and toolbar go side-by-side, both on desktop and on mobile.
|
2023-04-11 12:11:34 -05:00
|
|
|
set-window-size: (1100, 800)
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"])
|
|
|
|
compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 550})
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"])
|
|
|
|
compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 550})
|
2022-11-14 16:27:04 -06:00
|
|
|
|
|
|
|
// On mobile, they always wrap.
|
2023-04-11 12:11:34 -05:00
|
|
|
set-window-size: (600, 600)
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"])
|
|
|
|
compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 200})
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"])
|
|
|
|
compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 200})
|
2023-01-10 11:27:12 -06:00
|
|
|
|
|
|
|
// Now we will check that the scrolling is working.
|
|
|
|
// First on an item with "hidden methods".
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html"
|
2023-01-10 11:27:12 -06:00
|
|
|
|
|
|
|
click: ".item-decl .type-contents-toggle"
|
2023-01-30 12:05:12 -06:00
|
|
|
assert-property: ("pre.item-decl", {"scrollLeft": 0})
|
|
|
|
scroll-to: "//*[@class='rust item-decl']//details/a[text()='String']"
|
|
|
|
assert-property-false: ("pre.item-decl", {"scrollLeft": 0})
|
2023-01-10 11:27:12 -06:00
|
|
|
|
|
|
|
// Then on an item without "hidden methods".
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.TraitWithLongItemsName.html"
|
2023-01-30 12:05:12 -06:00
|
|
|
assert-property: ("pre.item-decl", {"scrollLeft": 0})
|
|
|
|
scroll-to: "//*[@class='rust item-decl']//code/a[text()='String']"
|
|
|
|
assert-property-false: ("pre.item-decl", {"scrollLeft": 0})
|