@@ -21,7 +21,7 @@ assert-css: (
21
21
set-local-storage: {"rustdoc-line-numbers": "true"}
22
22
reload:
23
23
// We wait for the line numbers to be added into the DOM by the JS...
24
- wait-for: "pre.example-line-numbers "
24
+ wait-for: ".digits-1 pre "
25
25
26
26
// Otherwise, we can't check text color
27
27
show-text: true
@@ -35,30 +35,21 @@ define-function: (
35
35
call-function: ("switch-theme", {"theme": |theme|})
36
36
// If the test didn't fail, it means that it was found!
37
37
assert-css: (
38
- "pre.example-line-numbers ",
38
+ ".digits-1 pre [data-nosnippet] ",
39
39
{
40
40
"color": |color|,
41
- "margin": "0px",
42
- "padding-top": "14px",
43
- "padding-bottom": "14px",
44
- "padding-left": "8px",
45
- "padding-right": "2px",
41
+ "margin-top": "0px",
42
+ "margin-bottom": "0px",
43
+ "margin-left": "0px",
44
+ "margin-right": "20px",
45
+ "padding-top": "0px",
46
+ "padding-bottom": "0px",
47
+ "padding-left": "4px",
48
+ "padding-right": "4px",
46
49
"text-align": "right",
47
- // There should not be a radius on the right of the line numbers.
48
- "border-top-left-radius": "6px",
49
- "border-bottom-left-radius": "6px",
50
- "border-top-right-radius": "0px",
51
- "border-bottom-right-radius": "0px",
52
50
},
53
51
ALL,
54
52
)
55
- // There should not be a radius on the left of the line numbers.
56
- assert-css: ("pre.example-line-numbers + .rust", {
57
- "border-top-left-radius": "0px",
58
- "border-bottom-left-radius": "0px",
59
- "border-top-right-radius": "6px",
60
- "border-bottom-right-radius": "6px",
61
- })
62
53
},
63
54
)
64
55
call-function: ("check-colors", {
@@ -74,9 +65,6 @@ call-function: ("check-colors", {
74
65
"color": "#c67e2d",
75
66
})
76
67
77
- // The first code block has two lines so let's check its `<pre>` elements lists both of them.
78
- assert-text: ("pre.example-line-numbers", "1\n2")
79
-
80
68
// Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
81
69
// and make sure it goes away.
82
70
@@ -87,42 +75,17 @@ assert-css: ("#settings", {"display": "block"})
87
75
88
76
// Then, click the toggle button.
89
77
click: "input#line-numbers"
90
- wait-for-false : "pre.example-line-numbers "
78
+ wait-for: ".digits-1.hide-lines "
91
79
assert-local-storage: {"rustdoc-line-numbers": "false" }
92
80
93
- // Check that the rounded corners are back.
94
- assert-css: (
95
- ".example-wrap .rust",
96
- {
97
- "border-top-left-radius": "6px",
98
- "border-bottom-left-radius": "6px",
99
- "border-top-right-radius": "6px",
100
- "border-bottom-right-radius": "6px",
101
- },
102
- ALL,
103
- )
104
-
105
81
// Finally, turn it on again.
106
82
click: "input#line-numbers"
107
- wait-for: "pre.example-line-numbers "
83
+ wait-for: ".digits-1:not(.hide-lines) "
108
84
assert-local-storage: {"rustdoc-line-numbers": "true" }
109
- wait-for: "pre.example-line-numbers"
110
85
111
86
// Same check with scraped examples line numbers.
112
87
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
113
88
114
- assert-css: (
115
- ".scraped-example .rust",
116
- {
117
- // There should not be a radius on the left of the code.
118
- "border-top-left-radius": "0px",
119
- "border-bottom-left-radius": "0px",
120
- "border-top-right-radius": "6px",
121
- "border-bottom-right-radius": "6px",
122
- },
123
- ALL,
124
- )
125
-
126
89
define-function: (
127
90
"check-padding",
128
91
[path, padding_bottom],
@@ -203,17 +166,18 @@ assert-local-storage: {"rustdoc-line-numbers": "true" }
203
166
assert: ".example-wrap > pre.language-txt"
204
167
assert: ".example-wrap > pre.rust"
205
168
assert-count: (".example-wrap", 2)
206
- assert-count: (".example-wrap > pre.example-line-numbers ", 2)
169
+ assert-count: (".example-wrap.digits-1 ", 2)
207
170
208
171
click: "#settings-menu"
209
172
wait-for: "#settings"
210
173
211
174
// Then, click the toggle button.
212
175
click: "input#line-numbers"
213
- wait-for-count: (".example-wrap > pre.example-line-numbers ", 0 )
176
+ wait-for-count: (".example-wrap.digits-1.hide-lines ", 2 )
214
177
assert-local-storage-false: {"rustdoc-line-numbers": "true" }
215
178
216
179
// Now turning off the setting.
217
180
click: "input#line-numbers"
218
- wait-for-count: (".example-wrap > pre.example-line-numbers", 2)
181
+ wait-for-count: (".example-wrap.digits-1", 2)
182
+ wait-for-count: (".example-wrap.digits-1.hide-lines", 0)
219
183
assert-local-storage: {"rustdoc-line-numbers": "true" }
0 commit comments