Skip to content

Commit 98b71bf

Browse files
Add GUI regression test for position of warning block
1 parent 279b11c commit 98b71bf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Diff for: tests/rustdoc-gui/src/test_docs/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ impl AsRef<str> for Foo {
8585
}
8686
}
8787

88+
/// <div id="doc-warning-0" class="warning">I have warnings!</div>
89+
pub struct WarningStruct;
90+
8891
/// Just a normal enum.
8992
///
9093
/// # title!

Diff for: tests/rustdoc-gui/warning-block.goml

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
33
show-text: true
44

5+
store-value: (default_y_pos, 5)
56
define-function: (
67
"check-warning",
78
(theme, color, border_color),
@@ -16,12 +17,18 @@ define-function: (
1617
"border-left": "2px solid " + |border_color|,
1718
"background-color": "transparent",
1819
})
20+
store-position: ("#doc-warning-1", {"y": warn_div_y})
21+
store-position: ("#doc-warning-1::before", {"y": warn_y})
22+
assert: |warn_y| == |warn_div_y| + |default_y_pos|
1923
assert-css: ("#doc-warning-2", {
2024
"margin-bottom": "0px",
2125
"color": |color|,
2226
"border-left": "2px solid " + |border_color|,
2327
"background-color": "transparent",
2428
})
29+
store-position: ("#doc-warning-2", {"y": warn_div_y})
30+
store-position: ("#doc-warning-2::before", {"y": warn_y})
31+
assert: |warn_y| == |warn_div_y| + |default_y_pos|
2532
},
2633
)
2734

@@ -40,3 +47,9 @@ call-function: ("check-warning", {
4047
"color": "black",
4148
"border_color": "#ff8e00",
4249
})
50+
51+
// We ensure that the warning element in the top doc is not overlaying the "[-]" button.
52+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WarningStruct.html"
53+
store-position: ("#doc-warning-0", {"y": warn_div_y})
54+
store-position: ("#doc-warning-0::before", {"y": warn_y})
55+
assert: |warn_y| == |warn_div_y| + |default_y_pos| + 15

0 commit comments

Comments
 (0)