Add GUI tests to ensure that rounded corners on code blocks are working as expected
This commit is contained in:
parent
5afc4619d4
commit
84259ff23b
1 changed files with 62 additions and 0 deletions
|
@ -5,6 +5,18 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
|
||||||
// We check that without this setting, there is no line number displayed.
|
// We check that without this setting, there is no line number displayed.
|
||||||
assert-false: "pre.example-line-numbers"
|
assert-false: "pre.example-line-numbers"
|
||||||
|
|
||||||
|
// All corners should be rounded.
|
||||||
|
assert-css: (
|
||||||
|
".example-wrap .rust",
|
||||||
|
{
|
||||||
|
"border-top-left-radius": "6px",
|
||||||
|
"border-bottom-left-radius": "6px",
|
||||||
|
"border-top-right-radius": "6px",
|
||||||
|
"border-bottom-right-radius": "6px",
|
||||||
|
},
|
||||||
|
ALL,
|
||||||
|
)
|
||||||
|
|
||||||
// We set the setting to show the line numbers on code examples.
|
// We set the setting to show the line numbers on code examples.
|
||||||
set-local-storage: {"rustdoc-line-numbers": "true"}
|
set-local-storage: {"rustdoc-line-numbers": "true"}
|
||||||
reload:
|
reload:
|
||||||
|
@ -29,9 +41,21 @@ define-function: (
|
||||||
"margin": "0px",
|
"margin": "0px",
|
||||||
"padding": "14px 8px",
|
"padding": "14px 8px",
|
||||||
"text-align": "right",
|
"text-align": "right",
|
||||||
|
// There should not be a radius on the right of the line numbers.
|
||||||
|
"border-top-left-radius": "6px",
|
||||||
|
"border-bottom-left-radius": "6px",
|
||||||
|
"border-top-right-radius": "0px",
|
||||||
|
"border-bottom-right-radius": "0px",
|
||||||
},
|
},
|
||||||
ALL,
|
ALL,
|
||||||
)
|
)
|
||||||
|
// There should not be a radius on the left of the line numbers.
|
||||||
|
assert-css: ("pre.example-line-numbers + .rust", {
|
||||||
|
"border-top-left-radius": "0px",
|
||||||
|
"border-bottom-left-radius": "0px",
|
||||||
|
"border-top-right-radius": "6px",
|
||||||
|
"border-bottom-right-radius": "6px",
|
||||||
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
call-function: ("check-colors", {
|
call-function: ("check-colors", {
|
||||||
|
@ -64,7 +88,45 @@ wait-for: 100 // wait-for-false does not exist
|
||||||
assert-false: "pre.example-line-numbers"
|
assert-false: "pre.example-line-numbers"
|
||||||
assert-local-storage: {"rustdoc-line-numbers": "false" }
|
assert-local-storage: {"rustdoc-line-numbers": "false" }
|
||||||
|
|
||||||
|
// Check that the rounded corners are back.
|
||||||
|
assert-css: (
|
||||||
|
".example-wrap .rust",
|
||||||
|
{
|
||||||
|
"border-top-left-radius": "6px",
|
||||||
|
"border-bottom-left-radius": "6px",
|
||||||
|
"border-top-right-radius": "6px",
|
||||||
|
"border-bottom-right-radius": "6px",
|
||||||
|
},
|
||||||
|
ALL,
|
||||||
|
)
|
||||||
|
|
||||||
// Finally, turn it on again.
|
// Finally, turn it on again.
|
||||||
click: "input#line-numbers"
|
click: "input#line-numbers"
|
||||||
wait-for: "pre.example-line-numbers"
|
wait-for: "pre.example-line-numbers"
|
||||||
assert-local-storage: {"rustdoc-line-numbers": "true" }
|
assert-local-storage: {"rustdoc-line-numbers": "true" }
|
||||||
|
|
||||||
|
// Same check with scraped examples line numbers.
|
||||||
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
||||||
|
|
||||||
|
assert-css: (
|
||||||
|
".scraped-example pre.src-line-numbers",
|
||||||
|
{
|
||||||
|
// There should not be a radius on the right of the line numbers.
|
||||||
|
"border-top-left-radius": "6px",
|
||||||
|
"border-bottom-left-radius": "6px",
|
||||||
|
"border-top-right-radius": "0px",
|
||||||
|
"border-bottom-right-radius": "0px",
|
||||||
|
},
|
||||||
|
ALL,
|
||||||
|
)
|
||||||
|
assert-css: (
|
||||||
|
".scraped-example .rust",
|
||||||
|
{
|
||||||
|
// There should not be a radius on the left of the code.
|
||||||
|
"border-top-left-radius": "0px",
|
||||||
|
"border-bottom-left-radius": "0px",
|
||||||
|
"border-top-right-radius": "6px",
|
||||||
|
"border-bottom-right-radius": "6px",
|
||||||
|
},
|
||||||
|
ALL,
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue