Skip to content

[rustdoc] Fix wrong i tooltip icon #144913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,10 @@ instead, we check that it's not a "finger" cursor.
border-right: 3px solid var(--target-border-color);
}

a.tooltip {
font-family: var(--font-family);
}

.code-header a.tooltip {
color: inherit;
margin-right: 15px;
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/notable-trait.goml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ define-function: (
[x, i_x],
block {
// Checking they have the same y position.
compare-elements-position: (
compare-elements-position-near: (
"//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
["y"],
{"y": 1},
)
// Checking they don't have the same x position.
compare-elements-position-false: (
Expand Down
14 changes: 14 additions & 0 deletions tests/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,3 +767,17 @@ pub mod impls_indent {
pub fn bar() {}
}
}

pub mod tooltips {
pub struct X;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also try with <div class="warning"></div> like in the original issue, just to make sure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like said above, can't reproduce the bug for this case. ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird.


impl X {
pub fn bar() -> Vec<u8> {
Vec::new()
}
}

pub fn bar() -> Vec<u8> {
Vec::new()
}
}
15 changes: 15 additions & 0 deletions tests/rustdoc-gui/tooltips.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This test checks that the right font is applied to the `i` tooltip element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably mention this is technically a regression test for #144778 (and also the PR description should mention this fixes that issue)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually not. Likely the same bug but I can't reproduce #144778 so I'll wait for @fmease to confirm that the fix I provide them is working as expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked, it doesn't address #144778.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolving conversation then. Thanks for confirming it @fmease!


define-function: (
"check-font",
[path],
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/" + |path|
assert-css: (
"a.tooltip", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'}, ALL,
)
}
)

call-function: ("check-font", {"path": "tooltips/fn.bar.html"})
call-function: ("check-font", {"path": "tooltips/struct.X.html"})
Loading