Skip to content

Commit 2abe3e9

Browse files
Add GUI tests to ensure that rounded corners on code blocks are working as expected
1 parent 163bb94 commit 2abe3e9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/rustdoc-gui/docblock-code-block-line-number.goml

+36
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
55
// We check that without this setting, there is no line number displayed.
66
assert-false: "pre.example-line-numbers"
77

8+
// All corners should be rounded.
9+
assert-css: (
10+
".example-wrap .rust",
11+
{
12+
"border-top-left-radius": "6px",
13+
"border-bottom-left-radius": "6px",
14+
"border-top-right-radius": "6px",
15+
"border-bottom-right-radius": "6px",
16+
},
17+
ALL,
18+
)
19+
820
// We set the setting to show the line numbers on code examples.
921
set-local-storage: {"rustdoc-line-numbers": "true"}
1022
reload:
@@ -29,9 +41,21 @@ define-function: (
2941
"margin": "0px",
3042
"padding": "14px 8px",
3143
"text-align": "right",
44+
// There should not be a radius on the right of the line numbers.
45+
"border-top-left-radius": "6px",
46+
"border-bottom-left-radius": "6px",
47+
"border-top-right-radius": "0px",
48+
"border-bottom-right-radius": "0px",
3249
},
3350
ALL,
3451
)
52+
// There should not be a radius on the left of the line numbers.
53+
assert-css: ("pre.example-line-numbers + .rust", {
54+
"border-top-left-radius": "0px",
55+
"border-bottom-left-radius": "0px",
56+
"border-top-right-radius": "6px",
57+
"border-bottom-right-radius": "6px",
58+
})
3559
},
3660
)
3761
call-function: ("check-colors", {
@@ -64,6 +88,18 @@ wait-for: 100 // wait-for-false does not exist
6488
assert-false: "pre.example-line-numbers"
6589
assert-local-storage: {"rustdoc-line-numbers": "false" }
6690

91+
// Check that the rounded corners are back.
92+
assert-css: (
93+
".example-wrap .rust",
94+
{
95+
"border-top-left-radius": "6px",
96+
"border-bottom-left-radius": "6px",
97+
"border-top-right-radius": "6px",
98+
"border-bottom-right-radius": "6px",
99+
},
100+
ALL,
101+
)
102+
67103
// Finally, turn it on again.
68104
click: "input#line-numbers"
69105
wait-for: "pre.example-line-numbers"

0 commit comments

Comments
 (0)