Skip to content
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

Fix more <a> color #91179

Merged
merged 2 commits into from
Nov 25, 2021
Merged
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
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ a {
}
a.srclink,
a#toggle-all-docs,
a.anchor,
.section-header a,
#source-sidebar a,
pre.rust a,
.sidebar a,
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ a {
}
a.srclink,
a#toggle-all-docs,
a.anchor,
.section-header a,
#source-sidebar a,
pre.rust a,
.sidebar a,
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ a {
}
a.srclink,
a#toggle-all-docs,
a.anchor,
.section-header a,
#source-sidebar a,
pre.rust a,
.sidebar a,
Expand Down
28 changes: 20 additions & 8 deletions src/test/rustdoc-gui/anchors.goml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
// This test is to ensure that the anchors (`§`) have the expected color.
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html

// This is needed to ensure that the text color is computed.
show-text: true
Copy link
Member Author

Choose a reason for hiding this comment

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

This was originally missing, meaning that the colors weren't computed. I'll add a failure in browser-ui-test directly.


// Set the theme to light.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:

assert-css: ("#toggle-all-docs", {"color": "rgba(0, 0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgba(0, 0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgba(0, 0, 0, 0)"})
assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 68, 142)"})
Copy link
Member Author

Choose a reason for hiding this comment

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

Therefore this color was updated as well (it's for a struct so not black contrary to the other members of the import).

assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})

assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})

assert-css: (".sidebar a", {"color": "rgb(0, 0, 0)"})
assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"})

assert-css: ("#top-doc-prose-title", {"color": "rgba(0, 0, 0, 0)"})
// We move the cursor over the "Implementations" title so the anchor is displayed.
move-cursor-to: "h2#implementations"
assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})

assert-css: (".sidebar a", {"color": "rgba(0, 0, 0, 0)"})
assert-css: (".in-band a", {"color": "rgba(0, 0, 0, 0)"})
// Same thing with the impl block title.
move-cursor-to: "#impl"
assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
9 changes: 9 additions & 0 deletions src/test/rustdoc-gui/headers-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ assert-css: ("#impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL)

goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".section-header a", {"color": "rgb(197, 197, 197)"}, ALL)

// Dark theme
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
Expand All @@ -30,6 +33,9 @@ assert-css: ("#impl", {"color": "rgb(221, 221, 221)", "background-color": "rgb(7
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
assert-css: ("#method\.must_use", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, ALL)

goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".section-header a", {"color": "rgb(221, 221, 221)"}, ALL)

// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
Expand All @@ -44,3 +50,6 @@ assert-css: ("#impl", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 25

goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
assert-css: ("#method\.must_use", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, ALL)

goto: file://|DOC_PATH|/test_docs/index.html
assert-css: (".section-header a", {"color": "rgb(0, 0, 0)"}, ALL)