Add test for line-number setting
This commit is contained in:
parent
e8b5af1c0a
commit
457f5782f3
22
src/test/rustdoc-gui/docblock-code-block-line-number.goml
Normal file
22
src/test/rustdoc-gui/docblock-code-block-line-number.goml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Checks that the setting "line numbers" is working as expected.
|
||||||
|
goto: file://|DOC_PATH|/test_docs/fn.foo.html
|
||||||
|
|
||||||
|
// We check that without this setting, there is no line number displayed.
|
||||||
|
assert-false: "pre.line-number"
|
||||||
|
|
||||||
|
// We now set the setting to show the line numbers on code examples.
|
||||||
|
local-storage: {"rustdoc-line-numbers": "true" }
|
||||||
|
// We reload to make the line numbers appear.
|
||||||
|
reload:
|
||||||
|
|
||||||
|
// We wait for them to be added into the DOM by the JS...
|
||||||
|
wait-for: "pre.line-number"
|
||||||
|
// If the test didn't fail, it means that it was found!
|
||||||
|
// Let's now check some CSS properties...
|
||||||
|
assert-css: ("pre.line-number", {
|
||||||
|
"margin": "0px",
|
||||||
|
"padding": "13px 8px",
|
||||||
|
"text-align": "right"
|
||||||
|
})
|
||||||
|
// The first code block has two lines so let's check its `<pre>` elements lists both of them.
|
||||||
|
assert-text: ("pre.line-number", "1\n2")
|
@ -12,6 +12,7 @@ use std::fmt;
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// println!("nothing fancy");
|
/// println!("nothing fancy");
|
||||||
|
/// println!("but with two lines!");
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// A failing to compile one:
|
/// A failing to compile one:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user