about summary refs log tree commit diff
path: root/src/test/rustdoc-gui
AgeCommit message (Collapse)AuthorLines
2022-12-13rustdoc: add CSS margin between `impl` docblock and its itemsMichael Howell-0/+17
2022-12-13rustdoc: apply `pre-wrap` CSS to code-wrapped linksMichael Howell-0/+9
This is common syntax used for intra-doc links, so fixing it should help with doc formatting.
2022-12-12Add check for local-storage value when changing "display line numbers" settingsGuillaume Gomez-0/+2
2022-12-09rustdoc: make stability badge CSS more consistentMichael Howell-0/+41
* They all get rounded corners now. A test case has been added for this, too. * There are now broadly two kinds of stability badge, where there used to be three: item-info "fat badge", and the "thin badge" in both item tables and in docblocks (which got merged). The fat badges can have icons, while the thin badges can't.
2022-12-09Rollup merge of #105442 - notriddle:notriddle/docblock-table-css, ↵Matthias Krüger-0/+50
r=GuillaumeGomez rustdoc: clean up docblock table CSS # Preview http://notriddle.com/notriddle-rustdoc-demos/table-2/test_dingus/fn.test.html # Before ![image](https://user-images.githubusercontent.com/1593513/206364287-1b80eaaf-2e0e-4138-8b56-4aa8ff39abac.png) # After ![image](https://user-images.githubusercontent.com/1593513/206364209-d287d165-31be-4de1-9b43-05b35ce2a86b.png) # Details * The rule `display: block` had no noticeable effect. Technically, because markdown tables have a tbody and thead, they get wrapped in an [anonymous table box] in the CSS tree, nested within the `<table>` element's block layout box. This rule was added in #87230 to make the table side-scrolling, but this same issue was doubly fixed in #88742 by wrapping it in an explicit `<div>` tag. Since accessibility advocates recommend the wrapper div over marking the table as `display: block`, we'll stick with that. https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html * The rule `width: calc(100% - 2px)` had no visible effect, because the anonymous table box was not affected. * The style is tweaked to basically be the same style GitHub uses. In particular, it adds zebra stripes, and removes dotted borders. https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Markdown.20table.20styling [anonymous table box]: https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes
2022-12-09Rollup merge of #105387 - willcrichton:scrape-examples-ui-improvements, ↵Matthias Krüger-0/+16
r=notriddle Improve Rustdoc scrape-examples UI This PR combines a few different improvements to the scrape-examples UI. See a live demo here: https://willcrichton.net/misc/scrape-examples/small-first-example/clap/struct.Arg.html ### 1. The first scraped example now takes up significantly less screen height. Inserting the first scraped example takes up a lot of vertical screen space. I don't want this addition to overwhelm users, so I decided to reduce the height of the initial example in two ways: (A) the default un-expanded height is reduced from 240px (10 LOC) to 120px (5 LOC), and (B) the link to the example is now positioned *over* the example instead of *atop* the example (only on desktop though, not mobile). The changes to `scrape-examples.js` and `rustdoc.css` implement this fix. Here is what an example docblock now looks like: ![Screen Shot 2022-12-06 at 10 02 21 AM](https://user-images.githubusercontent.com/663326/205987450-3940063c-5973-4a34-8579-baff6a43aa9b.png) ### 2. Expanding all docblocks will not expand "More examples". The "More examples blocks" are huge, so fully expanding everything on the page would take up too much vertical space. The changes to `main.js` implement this fix. This is tested in `scrape-examples-toggle.goml`. ### 3. Examples from binary crates are sorted higher than examples from library crates. Code that is written as an example of an API is probably better for learning than code that happens to use an API, but isn't intended for pedagogic purposes. Unfortunately Rustc doesn't know whether a particular crate comes from an example target (only Cargo knows this). But we can at least create a proxy that prefers examples from binary crates over library crates, which we know from `--crate-type`. This change is implemented by adding a new field `bin_crate` in `Options` (see `config.rs`). An `is_bin` field has been added to the scraped examples metadata (see `scrape_examples.rs`). Then the example sorting metric uses `is_bin` as the first entry of a lexicographic sort on `(is_bin, example_size, display_name)` (see `render/mod.rs`). Note that in the future we can consider adding another flag like `--scrape-examples-cargo-target` that would pass target information from Cargo into the example metadata. But I'm proposing a less intrusive change for now. ### 4. The scrape-examples help page has been updated to reflect the latest Cargo interface. See `scrape-examples-help.md`. r? `@notriddle` P.S. once this PR and rust-lang/cargo#11450 are merged, then I think the scrape-examples feature is officially ready for deployment on docs.rs!
2022-12-09Rollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddleMatthias Krüger-4/+0
Remove unused GUI test It's not testing anything so better just remove it. r? `@notriddle`
2022-12-08rustdoc: add GUI test case for docblock table colorsMichael Howell-0/+50
2022-12-07Factor scrape-examples toggle test into a new fileWill Crichton-38/+14
2022-12-07Add explanations to scrape-examples integration testWill Crichton-0/+6
2022-12-07Improve several aspects of the Rustdoc scrape-examples UI.Will Crichton-0/+34
* Examples take up less screen height. * Snippets from binary crates are prioritized. * toggle-all-docs does not expand "More examples" sections.
2022-12-06Rollup merge of #105320 - notriddle:notriddle/rustdoc-toggle-hideme-2, ↵Matthias Krüger-0/+10
r=GuillaumeGomez rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles This code uses a special `hideme` class anyway, so just style that.
2022-12-06Rollup merge of #105256 - GuillaumeGomez:comment-method-margins, r=notriddleYuki Okushi-0/+1
Add small comment explaining what `method-margins.goml` test is about r? `````@notriddle`````
2022-12-06Rollup merge of #104967 - willcrichton:fix-scrape-examples, r=notriddleYuki Okushi-0/+14
Fix UI issues with Rustdoc scrape-examples feature. A few regressions have been introduced into scrape-examples in the last few months. This commit fixes those regressions: * Help file was being loaded from the wrong place (introduced in f9e1f6ffdf03ec33cb29e20c88fc7bcc938c7f42). * CSS selector in JS has a typo (introduced in 14897180ae6a0506a5ad0a9f6a30ae1f75916179). * Line numbers in scraped example code snippets are overflowing (not sure if this was ever fixed). Changing from flexbox to grid display fixed this issue.
2022-12-05Restore missing newlineWill Crichton-1/+1
2022-12-05rustdoc: simplify CSS selectors on top-doc and non-exhaustive togglesMichael Howell-0/+10
This code uses a special `hideme` class anyway, so just style that.
2022-12-04Add small comment explaining what `method-margins.goml` test is aboutGuillaume Gomez-0/+1
2022-12-03Remove unused GUI testGuillaume Gomez-4/+0
2022-12-02Rollup merge of #105143 - notriddle:notriddle/scraped-example-list-font, ↵Matthias Krüger-0/+31
r=GuillaumeGomez rustdoc: use simpler CSS for setting the font on scraped examples
2022-12-02Rollup merge of #105132 - GuillaumeGomez:migrate-summary-toggle-to-var, ↵Matthias Krüger-0/+29
r=notriddle Migrate summary toggle filter to CSS variable r? `@notriddle`
2022-12-01rustdoc: use simpler CSS for setting the font on scraped examplesMichael Howell-0/+31
2022-12-01Add GUI test for toggle filter and opacityGuillaume Gomez-0/+29
2022-11-28rustdoc: remove `fnname` CSS class that's styled exactly like `fn`Michael Howell-5/+5
It's not obvious why this was ever a separate class name, since even in c4219a478354b464079b1b7ab081e071e8e39765 when it was first added, it was styled identically to regular `fn` links.
2022-11-27Rollup merge of #104955 - GuillaumeGomez:migrate-to-func, r=notriddleMatthias Krüger-17/+29
Switch rustdoc-gui test to function call r? `@notriddle`
2022-11-26Add test for scrape-examples next/prev buttonsWill Crichton-1/+15
2022-11-26Switch rustdoc-gui test to function callGuillaume Gomez-17/+29
2022-11-26rustdoc: improve popover focus handling JSMichael Howell-0/+52
This commit fixes a few inconsistencies and erratic behavior from the notable traits, settings, and sidebar popups: * It makes it so that pressing Escape closes the mobile sidebar. This is a bit difficult to do on iPhone, but on other setups like desktop tiling window managers, it's easy and makes sense. * It makes sure that pressing escape while a notable trait popover is open focuses the popover's toggle button, instead of leaving nothing focused, since that makes more sense with keyboard navigation. Clicking the settings, help, or sidebar buttons, however, will not focus the notable trait popover toggle button. * It ensures that notable trait and settings popovers are exclusive with the mobile sidebar. Nothing should ever overlap a popover, and there should never be more than one popover open at once.
2022-11-25rustdoc: revert tooltip background color on light theme to readableMichael Howell-1/+1
text #fff on background #fdffd3 fails the [WCAG color contrast checker], and seems like a mistake in 16b55903ee16503e7026677c169727d1907704c2. [WCAG color contrast checker]: https://accessibleweb.com/color-contrast-checker/
2022-11-25Rollup merge of #104849 - GuillaumeGomez:source-code-sidebar-css-migration, ↵Matthias Krüger-8/+36
r=notriddle Migrate source code elements style to CSS variables r? ``@notriddle``
2022-11-24Strenghten GUI test to include extra state in selectorGuillaume Gomez-6/+12
2022-11-24Extend GUI test to include more source code elements checksGuillaume Gomez-2/+24
2022-11-24Rollup merge of #104792 - notriddle:notriddle/crate-search-title-display, ↵Matthias Krüger-1/+2
r=GuillaumeGomez rustdoc: simplify `.search-results-title` CSS By using `display: flex`, we still get the never-wrapping layout with `#crate-search-div` maxing out and truncating its text. The title itself winds up always filling its parent, but since `#crate-search` doesn't have `flex-grow` set, it won't fill available space.
2022-11-23rustdoc: simplify `.search-results-title` CSSMichael Howell-1/+2
By using `display: flex`, we still get the never-wrapping layout with `#crate-search-div` maxing out and truncating its text. The title itself winds up always filling its parent, but since `#crate-search` doesn't have `flex-grow` set, it won't fill available space.
2022-11-22rustdoc: make struct fields `display: block`Michael Howell-0/+10
2022-11-22Rollup merge of #104666 - GuillaumeGomez:migrate-alias-search-result, ↵Matthias Krüger-17/+36
r=notriddle Migrate alias search result to CSS variables r? `@notriddle`
2022-11-21rustdoc: add test case for pointer cursorMichael Howell-0/+24
2022-11-21Extend GUI test for alias search resultGuillaume Gomez-17/+36
2022-11-20Rollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddleMatthias Krüger-0/+38
Migrate kdb style to CSS variables r? `@notriddle`
2022-11-20Rollup merge of #104611 - notriddle:notriddle/scrape-examples-button, ↵Matthias Krüger-1/+62
r=GuillaumeGomez rustdoc: use real buttons for scrape examples controls This makes the expand and switch controls keyboard-accessible. Preview: https://notriddle.com/notriddle-rustdoc-demos/scrape-examples-button/test_dingus/fn.test.html
2022-11-20Extend GUI tests to check kbd colorsGuillaume Gomez-0/+38
2022-11-19rustdoc: fix test caseMichael Howell-1/+1
2022-11-19rustdoc: add test case for scraped example expand GUIMichael Howell-0/+61
2022-11-19Rollup merge of #104577 - GuillaumeGomez:remove-focus-on-blur, r=notriddleMatthias Krüger-0/+30
Don't focus on notable trait parent when hiding it I clicked on a notable trait icon so the popup remained and then clicked on the settings menu. When the settings menu was blurred, it scrolled back to when the notable trait was, which isn't great. r? `@notriddle`
2022-11-19Extend GUI test to check notable traits blur behaviourGuillaume Gomez-0/+30
2022-11-18Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearthbors-0/+5
Rollup of 8 pull requests Successful merges: - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`) - #103378 (Fix mod_inv termination for the last iteration) - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS) - #103701 (Simplify some pointer method implementations) - #104047 (Diagnostics `icu4x` based list formatting.) - #104338 (Enforce that `dyn*` coercions are actually pointer-sized) - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`) - #104556 (rustdoc: use `code-header` class to format enum variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Rollup merge of #104556 - notriddle:notriddle/variant, r=GuillaumeGomezManish Goregaokar-0/+5
rustdoc: use `code-header` class to format enum variants The font size and weights should be exactly the same after this PR, but the spacing is changed to be the same as methods. Preview: http://notriddle.com/notriddle-rustdoc-demos/variant/test_dingus_enum/enum.TestEnum.html
2022-11-18Rollup merge of #104494 - GuillaumeGomez:migrate-gui-test-to-func, r=notriddleMatthias Krüger-162/+87
Migrate GUI test to use functions r? `@notriddle`
2022-11-17rustdoc: update tests for enum variant margin tweakMichael Howell-0/+5
2022-11-17Rollup merge of #104532 - GuillaumeGomez:migrate-tooltip-css, r=notriddleMatthias Krüger-4/+76
Migrate tooltip style to CSS variables
2022-11-17Rollup merge of #104366 - GuillaumeGomez:simplify-settings-theme-choice, ↵Matthias Krüger-45/+43
r=notriddle Simplify settings theme choice I removed the storage changes from https://github.com/rust-lang/rust/pull/98765 and only kept the UI changes. You can test it [here](https://rustdoc.crud.net/imperio/simplify-settings-theme-choice/foo/index.html). Discussion about this still in progress [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Last.20part.20of.20settings.20simplification). r? ````@notriddle````