Skip to content

Commit 26dccbf

Browse files
committed
rustdoc: add test case for background color of the sidebar toggle button
1 parent a7c0c9f commit 26dccbf

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/librustdoc/html/static/css/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ nav.sub {
418418
background-color: var(--sidebar-background-color);
419419
}
420420

421-
#sidebar-toggle:hover, #sidebar-toggle > button:focus {
421+
#sidebar-toggle > button:hover:hover, #sidebar-toggle > button:focus {
422422
background-color: var(--sidebar-background-color-hover);
423423
}
424424

src/test/rustdoc-gui/sidebar-source-code-display.goml

+27
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ assert-css: (
3030
"#source-sidebar .expand + .children a.selected",
3131
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
3232
)
33+
// Without hover or focus.
34+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
35+
// With focus.
36+
focus: "#sidebar-toggle > button"
37+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
38+
focus: ".search-input"
39+
// With hover.
40+
move-cursor-to: "#sidebar-toggle > button"
41+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
3342
// Without hover.
3443
assert-css: (
3544
"#source-sidebar .expand + .children > .files a:not(.selected)",
@@ -62,6 +71,15 @@ assert-css: (
6271
"#source-sidebar .expand + .children a.selected",
6372
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
6473
)
74+
// Without hover or focus.
75+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
76+
// With focus.
77+
focus: "#sidebar-toggle > button"
78+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
79+
focus: ".search-input"
80+
// With hover.
81+
move-cursor-to: "#sidebar-toggle > button"
82+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
6583
// Without hover.
6684
assert-css: (
6785
"#source-sidebar .expand + .children > .files a:not(.selected)",
@@ -94,6 +112,15 @@ assert-css: (
94112
"#source-sidebar .expand + .children a.selected",
95113
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
96114
)
115+
// Without hover or focus.
116+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
117+
// With focus.
118+
focus: "#sidebar-toggle > button"
119+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
120+
focus: ".search-input"
121+
// With hover.
122+
move-cursor-to: "#sidebar-toggle > button"
123+
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
97124
// Without hover.
98125
assert-css: (
99126
"#source-sidebar .expand + .children > .files a:not(.selected)",

0 commit comments

Comments
 (0)