Skip to content

Commit 34700f6

Browse files
committed
rustdoc: add GUI test case for docblock table colors
1 parent a09e8c5 commit 34700f6

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ pre, .rustdoc.source .example-wrap {
639639
border: 1px solid var(--border-color);
640640
}
641641

642-
.docblock table tr:nth-child(2n) {
642+
.docblock table tbody tr:nth-child(2n) {
643643
background: var(--table-alt-row-background-color);
644644
}
645645

src/test/rustdoc-gui/docblock-table.goml

+47
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,50 @@ goto: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.
22

33
compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"])
44
compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"])
5+
6+
define-function: (
7+
"check-colors",
8+
(theme, border_color, zebra_stripe_color),
9+
[
10+
("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
11+
("reload"),
12+
("assert-css", (".top-doc .docblock table tbody tr:nth-child(1)", {
13+
"background-color": "rgba(0, 0, 0, 0)",
14+
})),
15+
("assert-css", (".top-doc .docblock table tbody tr:nth-child(2)", {
16+
"background-color": |zebra_stripe_color|,
17+
})),
18+
("assert-css", (".top-doc .docblock table tbody tr:nth-child(3)", {
19+
"background-color": "rgba(0, 0, 0, 0)",
20+
})),
21+
("assert-css", (".top-doc .docblock table tbody tr:nth-child(4)", {
22+
"background-color": |zebra_stripe_color|,
23+
})),
24+
("assert-css", (".top-doc .docblock table td", {
25+
"border-style": "solid",
26+
"border-width": "1px",
27+
"border-color": |border_color|,
28+
})),
29+
("assert-css", (".top-doc .docblock table th", {
30+
"border-style": "solid",
31+
"border-width": "1px",
32+
"border-color": |border_color|,
33+
})),
34+
]
35+
)
36+
37+
call-function: ("check-colors", {
38+
"theme": "dark",
39+
"border_color": "rgb(224, 224, 224)",
40+
"zebra_stripe_color": "rgb(42, 42, 42)",
41+
})
42+
call-function: ("check-colors", {
43+
"theme": "ayu",
44+
"border_color": "rgb(92, 103, 115)",
45+
"zebra_stripe_color": "rgb(25, 31, 38)",
46+
})
47+
call-function: ("check-colors", {
48+
"theme": "light",
49+
"border_color": "rgb(224, 224, 224)",
50+
"zebra_stripe_color": "rgb(245, 245, 245)",
51+
})

src/test/rustdoc-gui/src/test_docs/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ pub mod doc_block_table {
343343
/// | header1 | header2 |
344344
/// |--------------------------|--------------------------|
345345
/// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
346+
/// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
347+
/// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
348+
/// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
346349
pub struct DocBlockTable {}
347350

348351
impl DocBlockTableTrait for DocBlockTable {

0 commit comments

Comments
 (0)