Commit graph

387 commits

Author SHA1 Message Date
Jonathan Brouwer
bce8c00e2f
Remove the 4 failing tests from rustdoc-gui 2026-02-06 01:13:41 +01:00
Guillaume Gomez
607ac4bb84 Remove rustdoc GUI flaky test 2026-02-04 17:09:57 +01:00
Guillaume Gomez
4e4192aa48 Try to fix rustdoc-gui/globals.goml flakyness 2026-02-03 16:07:25 +01:00
Guillaume Gomez
9e5820379d Fix flakyness issue with tests/rustdoc-gui/globals.goml test 2026-01-30 11:22:19 +01:00
Stuart Cook
3830f76b4a
Rollup merge of #151665 - arferreira:fix-rustdoc-contrast, r=GuillaumeGomez
Fix contrast ratio for `Since` element in rustdoc dark theme

Changed `--right-side-color` from `#808080` to `#ababab` in the dark theme.

<img width="742" height="784" alt="Screenshot 2026-01-25 at 8 04 29 PM" src="https://github.com/user-attachments/assets/38c5f0b9-2034-429f-87db-8a0ed8209b5d" />

Verified visually in dark theme, it's now more readable:

<img width="174" height="96" alt="Screenshot 2026-01-25 at 8 41 02 PM" src="https://github.com/user-attachments/assets/d0c30409-4374-48c4-ae9c-a0aec48e8957" />

Part of https://github.com/rust-lang/rust/issues/59845
Fixes rust-lang/rust#151422
2026-01-29 19:03:32 +11:00
Stuart Cook
f5822b672b
Rollup merge of #151559 - GuillaumeGomez:marker-hidden-deprecated-search, r=lolbinarycat
[rustdoc] Add a marker to tell users that there are hidden (deprecated) items in the search results

Someone on mastodon rightfully pointed out that having a visual indication that some search results were hidden would be a good idea if the "hide deprecated items" setting is enabled. In particular if no results are displayed.

It looks like this:

<img width="861" height="228" alt="Screenshot From 2026-01-24 00-26-33" src="https://github.com/user-attachments/assets/93aeef11-a550-47dc-9c78-219ea4fd822c" />

r? @lolbinarycat
2026-01-29 19:03:31 +11:00
Guillaume Gomez
21ebd03e5e Try to reduce rustdoc GUI tests flakyness 2026-01-26 16:18:36 +01:00
Antonio Souza
c7788af89a
Fix contrast ratio for Since element in rustodoc dark theme
Signed-off-by: Antonio Souza <arfs.antonio@gmail.com>
2026-01-26 06:53:53 -05:00
Guillaume Gomez
0e240d3232 Add GUI regression test for the display and content of the "hidden deprecated item marker" 2026-01-24 12:19:14 +01:00
ThanhNguyxn
78afe876f4 Add 'Skip to main content' link for keyboard navigation in rustdoc
Implements WCAG 2.4.1 (Level A) - Bypass Blocks accessibility feature.

Changes:
- Add skip-main-content link in page.html with tabindex=-1 on main-content
- Add CSS styling per reviewer feedback (outline border, themed colors)
- Add GOML test for skip navigation functionality

Fixes #151420
2026-01-23 18:19:00 +07:00
Guillaume Gomez
d5bacddca9 Update GUI test to new number of settings and add note about it 2026-01-20 15:58:34 +01:00
Guillaume Gomez
76ea822db2 Add rustdoc GUI regression test for #151209 2026-01-20 14:35:38 +01:00
Stuart Cook
88df8fd3ef
Rollup merge of #151091 - hide-deprecated-items, r=lolbinarycat
Add new "hide deprecated items" setting in rustdoc

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over https://github.com/rust-lang/rust/pull/149551.

This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156).

You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html).

r? @lolbinarycat
2026-01-20 18:00:09 +11:00
Guillaume Gomez
aef8112b26 Add test for search results of not yet deprecated search items
Improve the `perform-search` goml function to work when search is already open
2026-01-19 23:14:09 +01:00
Guillaume Gomez
9f965bcf76 Add rustdoc GUI test to ensure that the "hide deprecated items" setting is working as expected 2026-01-19 21:37:15 +01:00
Guillaume Gomez
4bacdf7b8b Reduce rustdoc GUI flakyness, take 2 2026-01-14 22:47:53 +01:00
Guillaume Gomez
62849e6441 Reduce flakyness for tests/rustdoc-gui/notable-trait.goml 2026-01-13 10:22:34 +01:00
Guillaume Gomez
fe307c5452
Rollup merge of #150816 - method-anchor, r=camelid
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
2026-01-09 12:00:01 +01:00
Guillaume Gomez
945e7c78d2 Use functions more in rustdoc GUI tests 2026-01-08 21:49:29 +01:00
Guillaume Gomez
16fbf6a27b Add check for trait impl method anchor 2026-01-08 21:47:12 +01:00
Guillaume Gomez
bfb117ac74 Clean up tests/rustdoc-gui/anchors.goml test code 2026-01-08 21:47:12 +01:00
Guillaume Gomez
c502d7fce0 Fix trait method anchor disappearing before user can click on it 2026-01-08 21:47:12 +01:00
Guillaume Gomez
665781513e Fix changes coming from browser-ui-test version update 2026-01-02 20:21:44 +01:00
Jonathan Brouwer
71c248a2e1
Rollup merge of #150396 - GuillaumeGomez:fix-line-numbers-hidden, r=lolbinarycat
[rustdoc] If line number setting is disabled, do not make line numbers take space

While working on https://github.com/rust-lang/rust/pull/150395, I realized that when enabled then disabled the "show line numbers" setting, instead of looking like initially:

<img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-44" src="https://github.com/user-attachments/assets/a24df2f2-61be-4db5-b60f-519b35425fd2" />

The "space" taken by line numbers was still there:

<img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-41" src="https://github.com/user-attachments/assets/b44af75d-52a4-4401-98e4-602b16bf6b9b" />

This PR fixes it.

First commit cleans up the `utils.goml` file a bit, I think I'll do more cleanup because switching the settings without reloading the page should make GUI tests a bit faster.

r? `@yotamofek`
2025-12-30 02:07:07 +01:00
Guillaume Gomez
c054e52bc9 Add GUI test for copying code when line numbers are displayed in code examples 2025-12-26 20:24:50 +01:00
Guillaume Gomez
99836fc6d4 Add GUI regression test for disabled line numbers 2025-12-26 20:13:27 +01:00
Guillaume Gomez
3d92872170 Clean up utils.goml file 2025-12-26 17:20:55 +01:00
Guillaume Gomez
13091ddc93 Make implementors list visible only when filled 2025-12-10 16:18:22 +01:00
Guillaume Gomez
985178dacf Add GUI test to ensure that negative impls are correctly sorted 2025-12-10 16:18:22 +01:00
Guillaume Gomez
a21affabf8 Fix invalid link generation for type alias methods 2025-11-24 17:01:32 +01:00
Michael Howell
c9293bfdae rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
bors
dd091003ac Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, r=GuillaumeGomez,notriddle
If a trait item appears in rustdoc search, hide the corrosponding impl items

fixes rust-lang/rust#138251

cc `@notriddle`
2025-10-03 08:43:43 +00:00
binarycat
2dd00d3391 fix rustdoc tests broke by trait item filtering 2025-10-02 15:28:00 -05:00
Guillaume Gomez
6cccea8731 Remove doc_auto_cfg feature as well 2025-09-27 11:30:57 +02:00
Matthias Krüger
1285b164e1
Rollup merge of #147047 - notriddle:toolbar-index, r=GuillaumeGomez
rustdoc: put the toolbar on the all item index
2025-09-26 06:36:33 +02:00
Michael Howell
51ae86dec9 rustdoc-search: add test case for all/index.html search 2025-09-25 15:45:11 -07:00
León Orell Valerian Liehr
85c193a4ed
rustdoc: hide #[repr(...)] if it isn't part of the public ABI 2025-09-25 11:49:27 +02:00
Guillaume Gomez
b6f8824315 Ensure that --html-after-content option is used to check scrape_examples_ice rustdoc GUI test 2025-09-05 15:13:08 +02:00
Janis
f67e29e5a8
squash fix render_call_locations panic when default span points at file outside of local_sources
add test against crashing with --html-after-content file

correctly add --html-after-content to env not args

formatting fix for rustdoc-call-locations-after-content/rmake.rs

Use local crate source file as default span in `render_call_locations`

- avoids unwrapping the first file added to the source map as a local file in
`href_from_span`

move test to tests/rustdoc-gui, rename to scrape_examples_ice

test link is correct

use rustdocflags, rename path in example, track lock file

factor out duplicate function calls

use compile-flags to make sure the after.html file is actually included in the rustdoc call

fix goml go-to path

increment assert-count in sidebar-source-code.goml

adjust crate-search width in search-result-display.goml

renamed Bar in scrape_examples_ice test

make crate name shorter ..
2025-09-02 01:38:23 +02:00
Guillaume Gomez
75cbd05d19 Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
bors
809200ec95 Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat
Add support for macro expansion in rustdoc source code pages

This is what it looks like:

![Screenshot From 2025-02-18 18-08-51](https://github.com/user-attachments/assets/ce2b3806-6218-47df-94bf-e9e9ed40cd41)

![image](https://github.com/user-attachments/assets/891042db-8632-4dba-9343-e28570c058fe)

You can test it [here](https://rustdoc.crud.net/imperio/macro-expansion/src/lib/lib.rs.html). In this case, I also enabled the `--generate-link-to-definition` to show that both options work well together.

Note: <del>There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948<del> Found a workaround around this bug.

r? `@notriddle`
2025-08-24 19:46:17 +00:00
Guillaume Gomez
f5fddc776c Improve code and add test with macro coming from another file from the same crate 2025-08-23 10:57:14 +02:00
Guillaume Gomez
b968ef8d19 Make macro expansion feature buttons accessible 2025-08-23 00:57:29 +02:00
Guillaume Gomez
f8b8cc4cce Do macro expansion at AST level rather than HIR 2025-08-23 00:57:29 +02:00
Guillaume Gomez
e6f9e2e623 Add GUI test for --generate-macro-expansion option 2025-08-23 00:57:28 +02:00
Michael Howell
53b775d9c6 rustdoc-search: GUI tests check for // in URL
When this fails, you get output that looks like:

    /home/user/rust/tests/rustdoc-gui/search-result-impl-disambiguation.goml search-result-impl-disambiguation... FAILED
    [ERROR] `tests/rustdoc-gui/utils.goml` around line 49
        from `tests/rustdoc-gui/search-result-impl-disambiguation.goml` line 25: JS errors occurred: Event: Event

Making the error message more informative requires patching browser-ui-test.
2025-08-21 09:24:54 -07:00
Michael Howell
8511e40e72 rustdoc-search: search backend with partitioned suffix tree 2025-08-15 10:26:03 -07:00
Guillaume Gomez
22607491bb Add GUI regression test for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
b4f404b581 Fix wrong font being used for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
7c3bddaa74 Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00