Skip to content

Commit

Permalink
Rollup merge of rust-lang#103088 - GuillaumeGomez:fix-settings-page, …
Browse files Browse the repository at this point in the history
…r=notriddle

Fix settings page

Thanks to rust-lang#103060, I discovered that the settings page was badly rendered. This PR fixes it.

Before:
![Screenshot from 2022-10-15 16-02-41](https://user-images.githubusercontent.com/3050060/195990668-42e0b16b-3146-4864-b822-6f6a80fb77a5.png)

After:
![Screenshot from 2022-10-15 16-02-31](https://user-images.githubusercontent.com/3050060/195990664-20f967df-8989-4336-bca9-be52baab8e81.png)

r? ``@notriddle``
  • Loading branch information
matthiaskrgr committed Oct 15, 2022
2 parents 8d21784 + 11a40ec commit 0d01e40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@
const innerHTML = `<div class="settings">${buildSettingsPageSections(settings)}</div>`;
const el = document.createElement(elementKind);
el.id = "settings";
el.className = "popover";
if (!isSettingsPage) {
el.className = "popover";
}
el.innerHTML = innerHTML;

if (isSettingsPage) {
Expand Down
11 changes: 9 additions & 2 deletions src/test/rustdoc-gui/settings.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This test ensures that the settings menu display is working as expected.
// This test ensures that the settings menu display is working as expected and that
// the settings page is also rendered as expected.
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true // needed when we check for colors below.
// First, we check that the settings page doesn't exist.
Expand Down Expand Up @@ -140,7 +141,13 @@ assert-css: ("#settings-menu .popover", {"display": "none"})
// Now we go to the settings page to check that the CSS is loaded as expected.
goto: "file://" + |DOC_PATH| + "/settings.html"
wait-for: "#settings"
assert-css: (".setting-line .toggle .slider", {"width": "45px", "margin-right": "20px"})
assert-css: (
".setting-line .toggle .slider",
{"width": "45px", "margin-right": "20px", "border": "0px none rgb(0, 0, 0)"},
)

assert-attribute-false: ("#settings", {"class": "popover"}, CONTAINS)
compare-elements-position: (".sub-container", "#settings", ("x"))

// We now check the display with JS disabled.
assert-false: "noscript section"
Expand Down

0 comments on commit 0d01e40

Please sign in to comment.