Skip to content

Commit f19aad8

Browse files
authored
Rollup merge of #86542 - GuillaumeGomez:line-numbers-aligned-with-content, r=jyn514
Line numbers aligned with content We had the issue a few times in the past where the source code pages' content wasn't aligned with the line numbers but completely below. This test will prevent this change to go unnoticed. The first commit comes from #86541 so it needs it to be merged first. r? `@jsha`
2 parents f9ebf1e + 5c9e10e commit f19aad8

9 files changed

+42
-40
lines changed

src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
7171
# https://github.com/puppeteer/puppeteer/issues/375
7272
#
7373
# We also specify the version in case we need to update it to go around cache limitations.
74-
RUN npm install -g browser-ui-test@0.3.0 --unsafe-perm=true
74+
RUN npm install -g browser-ui-test@0.4.0 --unsafe-perm=true
7575

7676
ENV RUST_CONFIGURE_ARGS \
7777
--build=x86_64-unknown-linux-gnu \

src/test/rustdoc-gui/escape-key.goml

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ goto: file://|DOC_PATH|/test_docs/index.html
22
// First, we check that the search results are hidden when the Escape key is pressed.
33
write: (".search-input", "test")
44
wait-for: "#search > h1" // The search element is empty before the first search
5-
assert-attr: ("#search", {"class": "content"})
6-
assert-attr: ("#main", {"class": "content hidden"})
5+
assert-attribute: ("#search", {"class": "content"})
6+
assert-attribute: ("#main", {"class": "content hidden"})
77
press-key: "Escape"
8-
assert-attr: ("#search", {"class": "content hidden"})
9-
assert-attr: ("#main", {"class": "content"})
8+
assert-attribute: ("#search", {"class": "content hidden"})
9+
assert-attribute: ("#main", {"class": "content"})
1010

1111
// Check that focusing the search input brings back the search results
1212
focus: ".search-input"
13-
assert-attr: ("#search", {"class": "content"})
14-
assert-attr: ("#main", {"class": "content hidden"})
13+
assert-attribute: ("#search", {"class": "content"})
14+
assert-attribute: ("#main", {"class": "content hidden"})
1515

1616
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
1717
// hide the search results too.
1818
click: "#help-button"
19-
assert-attr: ("#help", {"class": ""})
19+
assert-attribute: ("#help", {"class": ""})
2020
press-key: "Escape"
21-
assert-attr: ("#help", {"class": "hidden"})
22-
assert-attr: ("#search", {"class": "content"})
23-
assert-attr: ("#main", {"class": "content hidden"})
21+
assert-attribute: ("#help", {"class": "hidden"})
22+
assert-attribute: ("#search", {"class": "content"})
23+
assert-attribute: ("#main", {"class": "content hidden"})
2424

2525
// Check that Escape hides the search results when a search result is focused.
2626
focus: ".search-input"
@@ -29,6 +29,6 @@ press-key: "ArrowDown"
2929
assert-false: ".search-input:focus"
3030
assert: "#results a:focus"
3131
press-key: "Escape"
32-
assert-attr: ("#help", {"class": "hidden"})
33-
assert-attr: ("#search", {"class": "content hidden"})
34-
assert-attr: ("#main", {"class": "content"})
32+
assert-attribute: ("#help", {"class": "hidden"})
33+
assert-attribute: ("#search", {"class": "content hidden"})
34+
assert-attribute: ("#main", {"class": "content"})
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// This test ensures that the element corresponding to the hash is displayed.
22
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow
33
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
4-
assert-attr: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
4+
assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
55
// We first check that the impl block is open by default.
6-
assert-attr: ("#implementations + details", {"open": ""})
6+
assert-attribute: ("#implementations + details", {"open": ""})
77
// We collapse it.
88
click: "#implementations + details > summary"
99
// We check that it was collapsed as expected.
10-
assert-attr-false: ("#implementations + details", {"open": ""})
10+
assert-attribute-false: ("#implementations + details", {"open": ""})
1111
// To ensure that we will click on the currently hidden method.
1212
assert-text: (".sidebar-links > a", "must_use")
1313
click: ".sidebar-links > a"
1414
// We check that the impl block was opened as expected so that we can see the method.
15-
assert-attr: ("#implementations + details", {"open": ""})
15+
assert-attribute: ("#implementations + details", {"open": ""})
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This test ensures that the impl blocks are open by default.
22
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
3-
assert-attr: ("#main > details.implementors-toggle", {"open": ""})
3+
assert-attribute: ("#main > details.implementors-toggle", {"open": ""})

src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ goto: file://|DOC_PATH|/test_docs/index.html
22
write: (".search-input", "Foo")
33
// Waiting for the search results to appear...
44
wait-for: "#titles"
5-
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})
5+
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
66

77
// To go back to the original "state"
88
goto: file://|DOC_PATH|/test_docs/index.html
99
write: (".search-input", "-> String")
1010
// Waiting for the search results to appear...
1111
wait-for: "#titles"
1212
// With this search, only the last tab shouldn't be empty so it should be selected.
13-
assert-attr: ("#titles > button:nth-of-type(3)", {"class": "selected"})
13+
assert-attribute: ("#titles > button:nth-of-type(3)", {"class": "selected"})
1414

1515
// To go back to the original "state"
1616
goto: file://|DOC_PATH|/test_docs/index.html
1717
write: (".search-input", "-> Something")
1818
// Waiting for the search results to appear...
1919
wait-for: "#titles"
2020
// With this search, all the tabs are empty so the first one should remain selected.
21-
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})
21+
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})

src/test/rustdoc-gui/source-code-page.goml

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
33
click: (40, 224) // This is the position of the span for line 4.
44
// Unfortunately, "#4" isn't a valid query selector, so we have to go around that limitation
55
// by instead getting the nth span.
6-
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
6+
assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
77
// We now check that the good spans are highlighted
88
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
9-
assert-attr-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
10-
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
11-
assert-attr: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
12-
assert-attr: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
13-
assert-attr-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
9+
assert-attribute-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
10+
assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
11+
assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
12+
assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
13+
assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
14+
// This is to ensure that the content is correctly align with the line numbers.
15+
compare-elements-position: ("//*[@id='1']", ".rust > span", ("y"))
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
22
size: (433, 600)
3-
assert-attr: (".top-doc", {"open": ""})
3+
assert-attribute: (".top-doc", {"open": ""})
44
click: (4, 280) // This is the position of the top doc comment toggle
5-
assert-attr-false: (".top-doc", {"open": ""})
5+
assert-attribute-false: (".top-doc", {"open": ""})
66
click: (4, 280)
7-
assert-attr: (".top-doc", {"open": ""})
7+
assert-attribute: (".top-doc", {"open": ""})
88
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
99
click: (3, 280)
10-
assert-attr: (".top-doc", {"open": ""})
10+
assert-attribute: (".top-doc", {"open": ""})
1111

1212
// Now we do the same but with a little bigger width
1313
size: (600, 600)
14-
assert-attr: (".top-doc", {"open": ""})
14+
assert-attribute: (".top-doc", {"open": ""})
1515
click: (4, 240) // New Y position since all search elements are back on one line.
16-
assert-attr-false: (".top-doc", {"open": ""})
16+
assert-attribute-false: (".top-doc", {"open": ""})
1717
click: (4, 240)
18-
assert-attr: (".top-doc", {"open": ""})
18+
assert-attribute: (".top-doc", {"open": ""})
1919
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
2020
click: (3, 240)
21-
assert-attr: (".top-doc", {"open": ""})
21+
assert-attribute: (".top-doc", {"open": ""})

src/test/rustdoc-gui/toggle-docs.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
goto: file://|DOC_PATH|/test_docs/index.html
2-
assert-attr: ("#main > details.top-doc", {"open": ""})
2+
assert-attribute: ("#main > details.top-doc", {"open": ""})
33
click: "#toggle-all-docs"
44
wait-for: 1000
55
// This is now collapsed so there shouldn't be the "open" attribute on details.
6-
assert-attr-false: ("#main > details.top-doc", {"open": ""})
6+
assert-attribute-false: ("#main > details.top-doc", {"open": ""})
77
click: "#toggle-all-docs"
88
wait-for: 1000
99
// Not collapsed anymore so the "open" attribute should be back.
10-
assert-attr: ("#main > details.top-doc", {"open": ""})
10+
assert-attribute: ("#main > details.top-doc", {"open": ""})

src/test/rustdoc-gui/toggled-open-implementations.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// has all the implementations toggled open by default, so users can
33
// find method names in those implementations with Ctrl-F.
44
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
5-
assert-attr: (".rustdoc-toggle.implementors-toggle", {"open": ""})
5+
assert-attribute: (".rustdoc-toggle.implementors-toggle", {"open": ""})

0 commit comments

Comments
 (0)