Skip to content

Commit

Permalink
rustdoc: add test case for background color of the sidebar toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jul 2, 2022
1 parent a7c0c9f commit 26dccbf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ nav.sub {
background-color: var(--sidebar-background-color);
}

#sidebar-toggle:hover, #sidebar-toggle > button:focus {
#sidebar-toggle > button:hover:hover, #sidebar-toggle > button:focus {
background-color: var(--sidebar-background-color-hover);
}

Expand Down
27 changes: 27 additions & 0 deletions src/test/rustdoc-gui/sidebar-source-code-display.goml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
)
// Without hover or focus.
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
// With focus.
focus: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
focus: ".search-input"
// With hover.
move-cursor-to: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
Expand Down Expand Up @@ -62,6 +71,15 @@ assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
)
// Without hover or focus.
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
// With focus.
focus: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
focus: ".search-input"
// With hover.
move-cursor-to: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
Expand Down Expand Up @@ -94,6 +112,15 @@ assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)
// Without hover or focus.
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
// With focus.
focus: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
focus: ".search-input"
// With hover.
move-cursor-to: "#sidebar-toggle > button"
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
Expand Down

0 comments on commit 26dccbf

Please sign in to comment.