1 // Checks that the setting "line numbers" is working as expected.
3 go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
5 // We check that without this setting, there is no line number displayed.
6 assert-false: "pre.example-line-numbers"
8 // We set the setting to show the line numbers on code examples.
9 set-local-storage: {"rustdoc-line-numbers": "true"}
11 // We wait for the line numbers to be added into the DOM by the JS...
12 wait-for: "pre.example-line-numbers"
14 // Otherwise, we can't check text color
17 // Let's now check some CSS properties...
22 // Page will be reloaded in "switch-theme".
23 call-function: ("switch-theme", {"theme": |theme|})
24 // If the test didn't fail, it means that it was found!
26 "pre.example-line-numbers",
30 "padding": "14px 8px",
31 "text-align": "right",
37 call-function: ("check-colors", {
41 call-function: ("check-colors", {
45 call-function: ("check-colors", {
50 // The first code block has two lines so let's check its `<pre>` elements lists both of them.
51 assert-text: ("pre.example-line-numbers", "1\n2")
53 // Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
54 // and make sure it goes away.
56 // First, open the settings menu.
57 click: "#settings-menu"
59 assert-css: ("#settings", {"display": "block"})
61 // Then, click the toggle button.
62 click: "input#line-numbers"
63 wait-for: 100 // wait-for-false does not exist
64 assert-false: "pre.example-line-numbers"
65 assert-local-storage: {"rustdoc-line-numbers": "false" }
67 // Finally, turn it on again.
68 click: "input#line-numbers"
69 wait-for: "pre.example-line-numbers"
70 assert-local-storage: {"rustdoc-line-numbers": "true" }