Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
71
tests/rustdoc-gui/docblock-code-block-line-number.goml
Normal file
71
tests/rustdoc-gui/docblock-code-block-line-number.goml
Normal file
|
@ -0,0 +1,71 @@
|
|||
// Checks that the setting "line numbers" is working as expected.
|
||||
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
|
||||
|
||||
// Otherwise, we can't check text color
|
||||
show-text: true
|
||||
|
||||
// We check that without this setting, there is no line number displayed.
|
||||
assert-false: "pre.example-line-numbers"
|
||||
|
||||
// Let's now check some CSS properties...
|
||||
define-function: (
|
||||
"check-colors",
|
||||
(theme, color),
|
||||
block {
|
||||
// We now set the setting to show the line numbers on code examples.
|
||||
local-storage: {
|
||||
"rustdoc-theme": |theme|,
|
||||
"rustdoc-use-system-theme": "false",
|
||||
"rustdoc-line-numbers": "true"
|
||||
}
|
||||
// We reload to make the line numbers appear and change theme.
|
||||
reload:
|
||||
// We wait for them to be added into the DOM by the JS...
|
||||
wait-for: "pre.example-line-numbers"
|
||||
// If the test didn't fail, it means that it was found!
|
||||
assert-css: (
|
||||
"pre.example-line-numbers",
|
||||
{
|
||||
"color": |color|,
|
||||
"margin": "0px",
|
||||
"padding": "14px 8px",
|
||||
"text-align": "right",
|
||||
},
|
||||
ALL,
|
||||
)
|
||||
},
|
||||
)
|
||||
call-function: ("check-colors", {
|
||||
"theme": "ayu",
|
||||
"color": "rgb(92, 103, 115)",
|
||||
})
|
||||
call-function: ("check-colors", {
|
||||
"theme": "dark",
|
||||
"color": "rgb(59, 145, 226)",
|
||||
})
|
||||
call-function: ("check-colors", {
|
||||
"theme": "light",
|
||||
"color": "rgb(198, 126, 45)",
|
||||
})
|
||||
|
||||
// The first code block has two lines so let's check its `<pre>` elements lists both of them.
|
||||
assert-text: ("pre.example-line-numbers", "1\n2")
|
||||
|
||||
// Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
|
||||
// and make sure it goes away.
|
||||
|
||||
// First, open the settings menu.
|
||||
click: "#settings-menu"
|
||||
wait-for: "#settings"
|
||||
assert-css: ("#settings", {"display": "block"})
|
||||
|
||||
// Then, click the toggle button.
|
||||
click: "input#line-numbers"
|
||||
wait-for: 100 // wait-for-false does not exist
|
||||
assert-false: "pre.example-line-numbers"
|
||||
assert-local-storage: {"rustdoc-line-numbers": "false" }
|
||||
|
||||
// Finally, turn it on again.
|
||||
click: "input#line-numbers"
|
||||
wait-for: "pre.example-line-numbers"
|
||||
assert-local-storage: {"rustdoc-line-numbers": "true" }
|
Loading…
Add table
Add a link
Reference in a new issue