Skip to content

Commit 55058b6

Browse files
Add GUI tests for line numbers padding
1 parent 38bf289 commit 55058b6

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

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

+62-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ define-function: (
3939
{
4040
"color": |color|,
4141
"margin": "0px",
42-
"padding": "14px 8px",
42+
"padding-top": "14px",
43+
"padding-bottom": "14px",
44+
"padding-left": "8px",
45+
"padding-right": "2px",
4346
"text-align": "right",
4447
// There should not be a radius on the right of the line numbers.
4548
"border-top-left-radius": "6px",
@@ -141,3 +144,61 @@ assert-css: (
141144
},
142145
ALL,
143146
)
147+
148+
// Checking line numbers on scraped code examples.
149+
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
150+
151+
define-function: (
152+
"check-padding",
153+
[path, padding_bottom],
154+
block {
155+
assert-css: (|path| + " .src-line-numbers", {
156+
"padding-top": "0px",
157+
"padding-bottom": "0px",
158+
"padding-left": "0px",
159+
"padding-right": "0px",
160+
})
161+
assert-css: (|path| + " .src-line-numbers > pre", {
162+
"padding-top": "14px",
163+
"padding-bottom": |padding_bottom|,
164+
"padding-left": "0px",
165+
"padding-right": "0px",
166+
})
167+
assert-css: (|path| + " .src-line-numbers > pre > span", {
168+
"padding-top": "0px",
169+
"padding-bottom": "0px",
170+
"padding-left": "8px",
171+
"padding-right": "8px",
172+
})
173+
},
174+
)
175+
176+
call-function: ("check-padding", {
177+
"path": ".scraped-example .example-wrap",
178+
"padding_bottom": "0px",
179+
})
180+
181+
move-cursor-to: ".scraped-example .example-wrap .rust"
182+
wait-for: ".scraped-example .example-wrap .button-holder .expand"
183+
click: ".scraped-example .example-wrap .button-holder .expand"
184+
wait-for: ".scraped-example.expanded"
185+
186+
call-function: ("check-padding", {
187+
"path": ".scraped-example.expanded .example-wrap",
188+
"padding_bottom": "14px",
189+
})
190+
191+
// Now checking the line numbers in the source code page.
192+
click: ".src"
193+
assert-css: (".src-line-numbers", {
194+
"padding-top": "20px",
195+
"padding-bottom": "20px",
196+
"padding-left": "4px",
197+
"padding-right": "0px",
198+
})
199+
assert-css: (".src-line-numbers > a", {
200+
"padding-top": "0px",
201+
"padding-bottom": "0px",
202+
"padding-left": "8px",
203+
"padding-right": "8px",
204+
})

0 commit comments

Comments
 (0)