@@ -87,7 +87,7 @@ assert-css: ("#settings", {"display": "block"})
87
87
88
88
// Then, click the toggle button.
89
89
click: "input#line-numbers"
90
- wait-for: 100 // wait-for-false does not exist
90
+ wait-for: 100 // FIXME: ` wait-for-false` does not exist
91
91
assert-false: "pre.example-line-numbers"
92
92
assert-local-storage: {"rustdoc-line-numbers": "false" }
93
93
@@ -107,6 +107,8 @@ assert-css: (
107
107
click: "input#line-numbers"
108
108
wait-for: "pre.example-line-numbers"
109
109
assert-local-storage: {"rustdoc-line-numbers": "true" }
110
+ wait-for: 100 // FIXME: `wait-for-false` does not exist
111
+ assert: "pre.example-line-numbers"
110
112
111
113
// Same check with scraped examples line numbers.
112
114
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
@@ -145,9 +147,6 @@ assert-css: (
145
147
ALL,
146
148
)
147
149
148
- // Checking line numbers on scraped code examples.
149
- go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
150
-
151
150
define-function: (
152
151
"check-padding",
153
152
[path, padding_bottom],
@@ -157,19 +156,19 @@ define-function: (
157
156
"padding-bottom": "0px",
158
157
"padding-left": "0px",
159
158
"padding-right": "0px",
160
- })
159
+ }, ALL )
161
160
assert-css: (|path| + " .src-line-numbers > pre", {
162
161
"padding-top": "14px",
163
162
"padding-bottom": |padding_bottom|,
164
163
"padding-left": "0px",
165
164
"padding-right": "0px",
166
- })
165
+ }, ALL )
167
166
assert-css: (|path| + " .src-line-numbers > pre > span", {
168
167
"padding-top": "0px",
169
168
"padding-bottom": "0px",
170
169
"padding-left": "8px",
171
170
"padding-right": "8px",
172
- })
171
+ }, ALL )
173
172
},
174
173
)
175
174
@@ -188,6 +187,35 @@ call-function: ("check-padding", {
188
187
"padding_bottom": "14px",
189
188
})
190
189
190
+ define-function: ("check-line-numbers-existence", [], block {
191
+ assert-local-storage: {"rustdoc-line-numbers": "true" }
192
+ assert-false: ".example-line-numbers"
193
+ click: "#settings-menu"
194
+ wait-for: "#settings"
195
+
196
+ // Then, click the toggle button.
197
+ click: "input#line-numbers"
198
+ wait-for: 100 // FIXME: `wait-for-false` does not exist
199
+ assert-local-storage-false: {"rustdoc-line-numbers": "true" }
200
+ assert-false: ".example-line-numbers"
201
+ // Line numbers should still be there.
202
+ assert: ".src-line-numbers"
203
+ // Now disabling the setting.
204
+ click: "input#line-numbers"
205
+ wait-for: 100 // FIXME: `wait-for-false` does not exist
206
+ assert-local-storage: {"rustdoc-line-numbers": "true" }
207
+ assert-false: ".example-line-numbers"
208
+ // Line numbers should still be there.
209
+ assert: ".src-line-numbers"
210
+ // Closing settings menu.
211
+ click: "#settings-menu"
212
+ wait-for-css: ("#settings", {"display": "none"})
213
+ })
214
+
215
+ // Checking that turning off the line numbers setting won't remove line numbers from scraped
216
+ // examples.
217
+ call-function: ("check-line-numbers-existence", {})
218
+
191
219
// Now checking the line numbers in the source code page.
192
220
click: ".src"
193
221
assert-css: (".src-line-numbers", {
@@ -202,3 +230,28 @@ assert-css: (".src-line-numbers > a", {
202
230
"padding-left": "8px",
203
231
"padding-right": "8px",
204
232
})
233
+ // Checking that turning off the line numbers setting won't remove line numbers.
234
+ call-function: ("check-line-numbers-existence", {})
235
+
236
+ // Now checking that even non-rust code blocks have line numbers generated.
237
+ go-to: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html"
238
+ assert-local-storage: {"rustdoc-line-numbers": "true" }
239
+ assert: ".example-wrap > pre.language-txt"
240
+ assert: ".example-wrap > pre.rust"
241
+ assert-count: (".example-wrap", 2)
242
+ assert-count: (".example-wrap > pre.example-line-numbers", 2)
243
+
244
+ click: "#settings-menu"
245
+ wait-for: "#settings"
246
+
247
+ // Then, click the toggle button.
248
+ click: "input#line-numbers"
249
+ wait-for: 100 // FIXME: `wait-for-false` does not exist
250
+ assert-local-storage-false: {"rustdoc-line-numbers": "true" }
251
+ assert-count: (".example-wrap > pre.example-line-numbers", 0)
252
+
253
+ // Now turning off the setting.
254
+ click: "input#line-numbers"
255
+ wait-for: 100 // FIXME: `wait-for-false` does not exist
256
+ assert-local-storage: {"rustdoc-line-numbers": "true" }
257
+ assert-count: (".example-wrap > pre.example-line-numbers", 2)
0 commit comments