@@ -21,7 +21,7 @@ assert-css: (
2121set-local-storage: {"rustdoc-line-numbers": "true"}
2222reload:
2323// 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 "
2525
2626// Otherwise, we can't check text color
2727show-text: true
@@ -35,30 +35,21 @@ define-function: (
3535        call-function: ("switch-theme", {"theme": |theme|})
3636        // If the test didn't fail, it means that it was found!
3737        assert-css: (
38-             "pre.example-line-numbers ",
38+             ".digits-1 pre [data-nosnippet] ",
3939            {
4040                "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",
4649                "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",
5250            },
5351            ALL,
5452        )
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-         })
6253    },
6354)
6455call-function: ("check-colors", {
@@ -74,9 +65,6 @@ call-function: ("check-colors", {
7465    "color": "#c67e2d",
7566})
7667
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- 
8068// Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
8169// and make sure it goes away.
8270
@@ -87,42 +75,17 @@ assert-css: ("#settings", {"display": "block"})
8775
8876// Then, click the toggle button.
8977click: "input#line-numbers"
90- wait-for-false : "pre.example-line-numbers "
78+ wait-for: ".digits-1.hide-lines "
9179assert-local-storage: {"rustdoc-line-numbers": "false" }
9280
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- 
10581// Finally, turn it on again.
10682click: "input#line-numbers"
107- wait-for: "pre.example-line-numbers "
83+ wait-for: ".digits-1:not(.hide-lines) "
10884assert-local-storage: {"rustdoc-line-numbers": "true" }
109- wait-for: "pre.example-line-numbers"
11085
11186// Same check with scraped examples line numbers.
11287go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
11388
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- 
12689define-function: (
12790    "check-padding",
12891    [path, padding_bottom],
@@ -203,17 +166,18 @@ assert-local-storage: {"rustdoc-line-numbers": "true" }
203166assert: ".example-wrap > pre.language-txt"
204167assert: ".example-wrap > pre.rust"
205168assert-count: (".example-wrap", 2)
206- assert-count: (".example-wrap > pre.example-line-numbers ", 2)
169+ assert-count: (".example-wrap.digits-1 ", 2)
207170
208171click: "#settings-menu"
209172wait-for: "#settings"
210173
211174// Then, click the toggle button.
212175click: "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 )
214177assert-local-storage-false: {"rustdoc-line-numbers": "true" }
215178
216179// Now turning off the setting.
217180click: "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)
219183assert-local-storage: {"rustdoc-line-numbers": "true" }
0 commit comments