Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing bottom border for headings in sidebar #90571

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ h1.fqn > .in-band > a:hover {
section hierarchies. */
h2,
.top-doc h3,
.top-doc h4 {
.top-doc h4,
.sidebar .others h3 {
border-bottom: 1px solid;
}
h3.code-header {
Expand Down
9 changes: 7 additions & 2 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ function hideThemeButtonState() {
// delayed sidebar rendering.
window.initSidebarItems = function(items) {
var sidebar = document.getElementsByClassName("sidebar-elems")[0];
var others;
var current = window.sidebarCurrent;

function addSidebarCrates(crates) {
Expand Down Expand Up @@ -594,7 +595,7 @@ function hideThemeButtonState() {
li.appendChild(link);
ul.appendChild(li);
}
sidebar.appendChild(div);
others.appendChild(div);
}

function block(shortty, longty) {
Expand Down Expand Up @@ -635,10 +636,14 @@ function hideThemeButtonState() {
ul.appendChild(li);
}
div.appendChild(ul);
sidebar.appendChild(div);
others.appendChild(div);
}

if (sidebar) {
others = document.createElement("div");
others.className = "others";
sidebar.appendChild(others);

var isModule = hasClass(document.body, "mod");
if (!isModule) {
block("primitive", "Primitive Types");
Expand Down
3 changes: 3 additions & 0 deletions src/test/rustdoc-gui/headings.goml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "15.2px"})
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})

assert-text: (".sidebar .others h3", "Modules")
assert-css: (".sidebar .others h3", {"border-bottom-width": "1px"}, ALL)

goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html

assert-css: ("h1.fqn", {"font-size": "24px"})
Expand Down
28 changes: 14 additions & 14 deletions src/test/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ assert-text: (".sidebar > .location", "Crate test_docs")
assert-count: (".sidebar .location", 1)
assert-text: (".sidebar-elems > #all-types", "See all test_docs's items")
// We check that we have the crates list and that the "current" on is "test_docs".
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "test_docs")
assert-text: (".sidebar-elems .crate > ul > li > a.current", "test_docs")
// And we're also supposed to have the list of items in the current module.
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Macros")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Structs")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Enums")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Traits")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Functions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Type Definitions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(8)", "Unions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(9)", "Keywords")
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems .items > ul > li:nth-child(2)", "Macros")
assert-text: (".sidebar-elems .items > ul > li:nth-child(3)", "Structs")
assert-text: (".sidebar-elems .items > ul > li:nth-child(4)", "Enums")
assert-text: (".sidebar-elems .items > ul > li:nth-child(5)", "Traits")
assert-text: (".sidebar-elems .items > ul > li:nth-child(6)", "Functions")
assert-text: (".sidebar-elems .items > ul > li:nth-child(7)", "Type Definitions")
assert-text: (".sidebar-elems .items > ul > li:nth-child(8)", "Unions")
assert-text: (".sidebar-elems .items > ul > li:nth-child(9)", "Keywords")
assert-text: ("#structs + .item-table .item-left > a", "Foo")
click: "#structs + .item-table .item-left > a"

Expand All @@ -24,13 +24,13 @@ assert-count: (".sidebar .location", 2)
assert-false: ".sidebar-elems > .crate"
// We now go back to the crate page to click on the "lib2" crate link.
goto: file://|DOC_PATH|/test_docs/index.html
click: ".sidebar-elems > .crate > ul > li:first-child > a"
click: ".sidebar-elems .crate > ul > li:first-child > a"

// PAGE: lib2/index.html
goto: file://|DOC_PATH|/lib2/index.html
assert-text: (".sidebar > .location", "Crate lib2")
// We check that we have the crates list and that the "current" on is now "lib2".
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
assert-text: (".sidebar-elems .crate > ul > li > a.current", "lib2")
// We now go to the "foobar" function page.
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
Expand All @@ -57,6 +57,6 @@ assert-false: ".sidebar-elems > .crate"
goto: ./sub_module/sub_sub_module/index.html
assert-text: (".sidebar > .location", "Module sub_sub_module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions")
assert-false: ".sidebar-elems .crate"
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + .item-table .item-left > a", "foo")