1 // Checks that the setting "line numbers" is working as expected.
2 go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
4 // Otherwise, we can't check text color
7 // We check that without this setting, there is no line number displayed.
8 assert-false: "pre.example-line-numbers"
10 // Let's now check some CSS properties...
15 // We now set the setting to show the line numbers on code examples.
17 "rustdoc-theme": |theme|,
18 "rustdoc-use-system-theme": "false",
19 "rustdoc-line-numbers": "true"
21 // We reload to make the line numbers appear and change theme.
23 // We wait for them to be added into the DOM by the JS...
24 wait-for: "pre.example-line-numbers"
25 // If the test didn't fail, it means that it was found!
27 "pre.example-line-numbers",
31 "padding": "14px 8px",
32 "text-align": "right",
38 call-function: ("check-colors", {
40 "color": "rgb(92, 103, 115)",
42 call-function: ("check-colors", {
44 "color": "rgb(59, 145, 226)",
46 call-function: ("check-colors", {
48 "color": "rgb(198, 126, 45)",
51 // The first code block has two lines so let's check its `<pre>` elements lists both of them.
52 assert-text: ("pre.example-line-numbers", "1\n2")
54 // Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
55 // and make sure it goes away.
57 // First, open the settings menu.
58 click: "#settings-menu"
60 assert-css: ("#settings", {"display": "block"})
62 // Then, click the toggle button.
63 click: "input#line-numbers"
64 wait-for: 100 // wait-for-false does not exist
65 assert-false: "pre.example-line-numbers"
66 assert-local-storage: {"rustdoc-line-numbers": "false" }
68 // Finally, turn it on again.
69 click: "input#line-numbers"
70 wait-for: "pre.example-line-numbers"
71 assert-local-storage: {"rustdoc-line-numbers": "true" }