diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 8a1ce9fb135..575ce6aa99a 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1821,9 +1821,9 @@ fn render_rightside( ); if let Some(l) = src_href { if has_stability { - write!(rightside, " · source", l) + write!(rightside, " · source", l) } else { - write!(rightside, "source", l) + write!(rightside, "source", l) } } if has_stability && has_src_ref { diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index a26fa374912..3e3fc8a0e72 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -227,7 +227,7 @@ fn emit_source( let desc = format!("Source of the Rust file `{}`.", filename.prefer_remapped()); let page = layout::Page { title: &title, - css_class: "source", + css_class: "src", root_path: &root_path, static_root_path: shared.static_root_path.as_deref(), description: &desc, diff --git a/src/librustdoc/html/static/css/noscript.css b/src/librustdoc/html/static/css/noscript.css index 54e8b6561f3..93aa11a5852 100644 --- a/src/librustdoc/html/static/css/noscript.css +++ b/src/librustdoc/html/static/css/noscript.css @@ -19,7 +19,7 @@ nav.sub { display: none; } -.source .sidebar { +.src .sidebar { display: none; } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b7f455259ef..fa7a29be6d3 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -194,7 +194,7 @@ h1, h2, h3, h4, h5, h6, .item-name > a, .out-of-band, span.since, -a.srclink, +a.src, #help-button > a, summary.hideme, .scraped-example-list, @@ -206,7 +206,7 @@ ul.all-items { #toggle-all-docs, a.anchor, .small-section-header a, -#source-sidebar a, +#src-sidebar a, .rust a, .sidebar h2 a, .sidebar h3 a, @@ -315,7 +315,7 @@ main { min-width: 0; /* avoid growing beyond the size limit */ } -.source main { +.src main { padding: 15px; } @@ -350,10 +350,10 @@ pre.item-decl { contain: initial; } -.source .content pre { +.src .content pre { padding: 20px; } -.rustdoc.source .example-wrap pre.src-line-numbers { +.rustdoc.src .example-wrap pre.src-line-numbers { padding: 20px 0 20px 4px; } @@ -392,7 +392,7 @@ img { left: 0; } -.rustdoc.source .sidebar { +.rustdoc.src .sidebar { flex-basis: 50px; border-right: 1px solid; overflow-x: hidden; @@ -402,7 +402,7 @@ img { } .sidebar, .mobile-topbar, .sidebar-menu-toggle, -#src-sidebar-toggle, #source-sidebar { +#src-sidebar-toggle, #src-sidebar { background-color: var(--sidebar-background-color); } @@ -410,16 +410,16 @@ img { background-color: var(--sidebar-background-color-hover); } -.source .sidebar > *:not(#src-sidebar-toggle) { +.src .sidebar > *:not(#src-sidebar-toggle) { visibility: hidden; } -.source-sidebar-expanded .source .sidebar { +.src-sidebar-expanded .src .sidebar { overflow-y: auto; flex-basis: 300px; } -.source-sidebar-expanded .source .sidebar > *:not(#src-sidebar-toggle) { +.src-sidebar-expanded .src .sidebar > *:not(#src-sidebar-toggle) { visibility: visible; } @@ -544,7 +544,7 @@ ul.block, .block li { flex-grow: 1; } -.rustdoc:not(.source) .example-wrap pre { +.rustdoc:not(.src) .example-wrap pre { overflow: auto hidden; } @@ -619,7 +619,7 @@ ul.block, .block li { } .docblock code, .docblock-short code, -pre, .rustdoc.source .example-wrap { +pre, .rustdoc.src .example-wrap { background-color: var(--code-block-background-color); } @@ -676,7 +676,7 @@ nav.sub { height: 34px; flex-grow: 1; } -.source nav.sub { +.src nav.sub { margin: 0 0 15px 0; } @@ -1074,7 +1074,7 @@ pre.rust .doccomment { color: var(--code-highlight-doc-comment-color); } -.rustdoc.source .example-wrap pre.rust a { +.rustdoc.src .example-wrap pre.rust a { background: var(--codeblock-link-background); } @@ -1301,22 +1301,22 @@ a.tooltip:hover::after { align-items: stretch; z-index: 10; } -#source-sidebar { +#src-sidebar { width: 100%; overflow: auto; } -#source-sidebar > .title { +#src-sidebar > .title { font-size: 1.5rem; text-align: center; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; } -#source-sidebar div.files > a:hover, details.dir-entry summary:hover, -#source-sidebar div.files > a:focus, details.dir-entry summary:focus { - background-color: var(--source-sidebar-background-hover); +#src-sidebar div.files > a:hover, details.dir-entry summary:hover, +#src-sidebar div.files > a:focus, details.dir-entry summary:focus { + background-color: var(--src-sidebar-background-hover); } -#source-sidebar div.files > a.selected { - background-color: var(--source-sidebar-background-selected); +#src-sidebar div.files > a.selected { + background-color: var(--src-sidebar-background-selected); } #src-sidebar-toggle > button { font-size: inherit; @@ -1619,8 +1619,8 @@ in source-script.js /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar, so don't bump down the main content or the sidebar. */ - .source main, - .rustdoc.source .sidebar { + .src main, + .rustdoc.src .sidebar { top: 0; padding: 0; height: 100vh; @@ -1628,8 +1628,8 @@ in source-script.js } .sidebar.shown, - .source-sidebar-expanded .source .sidebar, - .rustdoc:not(.source) .sidebar:focus-within { + .src-sidebar-expanded .src .sidebar, + .rustdoc:not(.src) .sidebar:focus-within { left: 0; } @@ -1709,7 +1709,7 @@ in source-script.js border-left: 0; } - .source-sidebar-expanded #src-sidebar-toggle { + .src-sidebar-expanded #src-sidebar-toggle { left: unset; top: unset; width: unset; @@ -1749,7 +1749,7 @@ in source-script.js display: inline; } - .source-sidebar-expanded .source .sidebar { + .src-sidebar-expanded .src .sidebar { max-width: 100vw; width: 100vw; } @@ -1769,7 +1769,7 @@ in source-script.js margin-left: 34px; } - .source nav.sub { + .src nav.sub { margin: 0; padding: var(--nav-sub-mobile-padding); } @@ -1792,7 +1792,7 @@ in source-script.js } @media print { - nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path, + nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path, details.toggle[open] > summary::before, details.toggle > summary::before, details.toggle.top-doc > summary { display: none; diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 7145baad256..d8dae51eb1b 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -89,8 +89,8 @@ Original by Dempfi (https://github.com/dempfi/ayu) --crate-search-div-hover-filter: invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%); --crate-search-hover-border: #e0e0e0; - --source-sidebar-background-selected: #14191f; - --source-sidebar-background-hover: #14191f; + --src-sidebar-background-selected: #14191f; + --src-sidebar-background-hover: #14191f; --table-alt-row-background-color: #191f26; --codeblock-link-background: #333; --scrape-example-toggle-line-background: #999; @@ -107,7 +107,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) h1, h2, h3, h4, h1 a, .sidebar h2 a, .sidebar h3 a, -#source-sidebar > .title { +#src-sidebar > .title { color: #fff; } h4 { @@ -124,15 +124,15 @@ h4 { .docblock pre > code, pre, pre > code, .item-info code, -.rustdoc.source .example-wrap { +.rustdoc.src .example-wrap { color: #e6e1cf; } .sidebar .current, .sidebar a:hover, -#source-sidebar div.files > a:hover, details.dir-entry summary:hover, -#source-sidebar div.files > a:focus, details.dir-entry summary:focus, -#source-sidebar div.files > a.selected { +#src-sidebar div.files > a:hover, details.dir-entry summary:hover, +#src-sidebar div.files > a:focus, details.dir-entry summary:focus, +#src-sidebar div.files > a.selected { color: #ffb44c; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 3c1186a5649..b653f61d536 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -84,8 +84,8 @@ --crate-search-div-hover-filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%); --crate-search-hover-border: #2196f3; - --source-sidebar-background-selected: #333; - --source-sidebar-background-hover: #444; + --src-sidebar-background-selected: #333; + --src-sidebar-background-hover: #444; --table-alt-row-background-color: #2A2A2A; --codeblock-link-background: #333; --scrape-example-toggle-line-background: #999; diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index f8c287137de..6be25fc0544 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -81,8 +81,8 @@ --crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%); --crate-search-hover-border: #717171; - --source-sidebar-background-selected: #fff; - --source-sidebar-background-hover: #e0e0e0; + --src-sidebar-background-selected: #fff; + --src-sidebar-background-hover: #e0e0e0; --table-alt-row-background-color: #F5F5F5; --codeblock-link-background: #eee; --scrape-example-toggle-line-background: #ccc; diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 6eb99136040..54f3603865c 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -74,11 +74,11 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) { function toggleSidebar() { const child = this.parentNode.children[0]; if (child.innerText === ">") { - addClass(document.documentElement, "source-sidebar-expanded"); + addClass(document.documentElement, "src-sidebar-expanded"); child.innerText = "<"; updateLocalStorage("source-sidebar-show", "true"); } else { - removeClass(document.documentElement, "source-sidebar-expanded"); + removeClass(document.documentElement, "src-sidebar-expanded"); child.innerText = ">"; updateLocalStorage("source-sidebar-show", "false"); } @@ -110,7 +110,7 @@ function createSourceSidebar() { container.insertBefore(sidebarToggle, container.firstChild); const sidebar = document.createElement("div"); - sidebar.id = "source-sidebar"; + sidebar.id = "src-sidebar"; let hasFoundFile = false; diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index 71961f6f2a9..af3ca42a6c0 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -185,7 +185,7 @@ updateTheme(); if (getSettingValue("source-sidebar-show") === "true") { // At this point in page load, `document.body` is not available yet. // Set a class on the `` element instead. - addClass(document.documentElement, "source-sidebar-expanded"); + addClass(document.documentElement, "src-sidebar-expanded"); } // If we navigate away (for example to a settings page), and then use the back or diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html index d4ec9c34b6f..f24cea5fd5a 100644 --- a/src/librustdoc/html/templates/page.html +++ b/src/librustdoc/html/templates/page.html @@ -42,7 +42,7 @@ {# #} {% if page.css_class.contains("crate") %} {# #} - {% else if page.css_class == "source" %} + {% else if page.css_class == "src" %} {# #} {# #} {% else if !page.css_class.contains("mod") %} @@ -85,7 +85,7 @@ {# #} {# #} {{ layout.external_html.before_content|safe }} - {% if page.css_class != "source" %} + {% if page.css_class != "src" %} {# #} ☰ {# #} {# #} @@ -99,7 +99,7 @@ {# #} {% endif %} {# #} - {% if page.css_class != "source" %} + {% if page.css_class != "src" %} {# #} {% if !layout.logo.is_empty() %} {# #} @@ -111,9 +111,9 @@ {{ sidebar|safe }} {# #} {# #} - {% if page.css_class != "source" %}{% endif %} + {% if page.css_class != "src" %}{% endif %} {# #} - {% if page.css_class == "source" %} + {% if page.css_class == "src" %} {# #} {% if !layout.logo.is_empty() %} {# #} @@ -144,7 +144,7 @@ {# #} {# #} {{ content|safe }} {# #} - {% if page.css_class != "source" %}{% endif %} + {% if page.css_class != "src" %}{% endif %} {# #} {{ layout.external_html.after_content|safe }} {# #} diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index 68a295ae095..1d215c26968 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -18,7 +18,7 @@ {% endif %} {% match src_href %} {% when Some with (href) %} - source · {#+ #} + source · {#+ #} {% else %} {% endmatch %} {# #} diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index e9b77296917..30b83f0da38 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -17,34 +17,34 @@ define-function: ( assert-css: (".main-heading h1 a:nth-of-type(1)", {"color": |main_heading_color|}) assert-css: (".main-heading a:nth-of-type(2)", {"color": |main_heading_type_color|}) assert-css: ( - ".rightside .srclink", + ".rightside a.src", {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, ALL, ) compare-elements-css: ( - ".rightside .srclink", - ".rightside.srclink", + ".rightside a.src", + "a.rightside.src", ["color", "text-decoration"], ) compare-elements-css: ( - ".main-heading .srclink", - ".rightside.srclink", + ".main-heading a.src", + "a.rightside.src", ["color", "text-decoration"], ) - move-cursor-to: ".main-heading .srclink" + move-cursor-to: ".main-heading a.src" assert-css: ( - ".main-heading .srclink", + ".main-heading a.src", {"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|}, ) - move-cursor-to: ".impl-items .rightside .srclink" + move-cursor-to: ".impl-items .rightside a.src" assert-css: ( - ".impl-items .rightside .srclink", + ".impl-items .rightside a.src", {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, ) - move-cursor-to: ".impl-items .rightside.srclink" + move-cursor-to: ".impl-items a.rightside.src" assert-css: ( - ".impl-items .rightside.srclink", + ".impl-items a.rightside.src", {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, ) diff --git a/tests/rustdoc-gui/basic-code.goml b/tests/rustdoc-gui/basic-code.goml index e372f711974..22ac5316184 100644 --- a/tests/rustdoc-gui/basic-code.goml +++ b/tests/rustdoc-gui/basic-code.goml @@ -1,6 +1,6 @@ // Small test to ensure the "src-line-numbers" element is only present once on // the page. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: ".srclink" +click: "a.src" wait-for: ".src-line-numbers" assert-count: (".src-line-numbers", 1) diff --git a/tests/rustdoc-gui/code-sidebar-toggle.goml b/tests/rustdoc-gui/code-sidebar-toggle.goml index 28c3712f307..d1efa45dc1d 100644 --- a/tests/rustdoc-gui/code-sidebar-toggle.goml +++ b/tests/rustdoc-gui/code-sidebar-toggle.goml @@ -1,7 +1,7 @@ // This test checks that the source code pages sidebar toggle is working as expected. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: ".srclink" +click: "a.src" wait-for: "#src-sidebar-toggle" click: "#src-sidebar-toggle" expect-failure: true -assert-css: ("#source-sidebar", { "left": "-300px" }) +assert-css: ("#src-sidebar", { "left": "-300px" }) diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 6adc36b0edb..fa7ed3586dd 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -1,4 +1,4 @@ -// We check the background color on the jump to definition links in the source code page. +// We check the background color on the jump to definition links in the src code page. go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" define-function: ( @@ -10,7 +10,7 @@ define-function: ( // We reload the page so the local storage settings are being used. reload: assert-css: ( - "body.source .example-wrap pre.rust a", + "body.src .example-wrap pre.rust a", {"background-color": |background_color|}, ALL, ) diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 0c680bcc9fb..33210c9fdc9 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -40,7 +40,7 @@ define-function: ( reload: wait-for-css: ("#src-sidebar-toggle", {"visibility": "visible"}) assert-css: ( - "#source-sidebar details[open] > .files a.selected", + "#src-sidebar details[open] > .files a.selected", {"color": |color_hover|, "background-color": |background|}, ) @@ -62,58 +62,58 @@ define-function: ( // Without hover or focus. assert-css: ( - "#source-sidebar details[open] > .files a:not(.selected)", + "#src-sidebar details[open] > .files a:not(.selected)", {"color": |color|, "background-color": |background_toggle|}, ) // With focus. - focus: "#source-sidebar details[open] > .files a:not(.selected)" + focus: "#src-sidebar details[open] > .files a:not(.selected)" wait-for-css: ( - "#source-sidebar details[open] > .files a:not(.selected):focus", + "#src-sidebar details[open] > .files a:not(.selected):focus", {"color": |color_hover|, "background-color": |background_hover|}, ) focus: ".search-input" // With hover. - move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" + move-cursor-to: "#src-sidebar details[open] > .files a:not(.selected)" assert-css: ( - "#source-sidebar details[open] > .files a:not(.selected):hover", + "#src-sidebar details[open] > .files a:not(.selected):hover", {"color": |color_hover|, "background-color": |background_hover|}, ) // Without hover or focus. assert-css: ( - "#source-sidebar .dir-entry summary", + "#src-sidebar .dir-entry summary", {"color": |color|, "background-color": |background_toggle|}, ) // With focus. - focus: "#source-sidebar .dir-entry summary" + focus: "#src-sidebar .dir-entry summary" wait-for-css: ( - "#source-sidebar .dir-entry summary:focus", + "#src-sidebar .dir-entry summary:focus", {"color": |color_hover|, "background-color": |background_hover|}, ) focus: ".search-input" // With hover. - move-cursor-to: "#source-sidebar .dir-entry summary" + move-cursor-to: "#src-sidebar .dir-entry summary" assert-css: ( - "#source-sidebar .dir-entry summary:hover", + "#src-sidebar .dir-entry summary:hover", {"color": |color_hover|, "background-color": |background_hover|}, ) // Without hover or focus. assert-css: ( - "#source-sidebar details[open] > .folders > details > summary", + "#src-sidebar details[open] > .folders > details > summary", {"color": |color|, "background-color": |background_toggle|}, ) // With focus. - focus: "#source-sidebar details[open] > .folders > details > summary" + focus: "#src-sidebar details[open] > .folders > details > summary" wait-for-css: ( - "#source-sidebar details[open] > .folders > details > summary:focus", + "#src-sidebar details[open] > .folders > details > summary:focus", {"color": |color_hover|, "background-color": |background_hover|}, ) focus: ".search-input" // With hover. - move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" + move-cursor-to: "#src-sidebar details[open] > .folders > details > summary" assert-css: ( - "#source-sidebar details[open] > .folders > details > summary:hover", + "#src-sidebar details[open] > .folders > details > summary:hover", {"color": |color_hover|, "background-color": |background_hover|}, ) }, @@ -190,16 +190,16 @@ assert-window-property: {"pageYOffset": "2542"} // make it the current selection. set-window-size: (500, 700) click: "#src-sidebar-toggle" -wait-for-css: ("#source-sidebar", {"visibility": "visible"}) +wait-for-css: ("#src-sidebar", {"visibility": "visible"}) assert-local-storage: {"rustdoc-source-sidebar-show": "true"} click: ".sidebar a.selected" go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" -wait-for-css: ("#source-sidebar", {"visibility": "hidden"}) +wait-for-css: ("#src-sidebar", {"visibility": "hidden"}) assert-local-storage: {"rustdoc-source-sidebar-show": "false"} // Resize back to desktop size, to check that the sidebar doesn't spontaneously open. set-window-size: (1000, 1000) -wait-for-css: ("#source-sidebar", {"visibility": "hidden"}) +wait-for-css: ("#src-sidebar", {"visibility": "hidden"}) assert-local-storage: {"rustdoc-source-sidebar-show": "false"} click: "#src-sidebar-toggle" -wait-for-css: ("#source-sidebar", {"visibility": "visible"}) +wait-for-css: ("#src-sidebar", {"visibility": "visible"}) assert-local-storage: {"rustdoc-source-sidebar-show": "true"} diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index 2cb88817884..69c589741cb 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -14,7 +14,7 @@ define-function: ( } reload: // Checking results colors. - assert-css: (".source .sidebar", { + assert-css: (".src .sidebar", { "color": |color|, "background-color": |background_color| }, ALL) @@ -53,8 +53,8 @@ assert-css: ("nav.sidebar", {"width": "50px"}) // We now click on the button to expand the sidebar. click: (10, 10) // We wait for the sidebar to be expanded. -wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "300px"}) -assert-css: (".source-sidebar-expanded nav.sidebar a", {"font-size": "14px"}) +wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"}) +assert-css: (".src-sidebar-expanded nav.sidebar a", {"font-size": "14px"}) // We collapse the sidebar. click: (10, 10) // We ensure that the class has been removed. @@ -66,24 +66,24 @@ go-to: "file://" + |DOC_PATH| + "/src/lib2/another_folder/sub_mod/mod.rs.html" // First we expand the sidebar again. click: (10, 10) // We wait for the sidebar to be expanded. -wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "300px"}) +wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"}) assert: "//*[@class='dir-entry' and @open]/*[text()='lib2']" assert: "//*[@class='dir-entry' and @open]/*[text()='another_folder']" assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']" // Only "another_folder" should be "open" in "lib2". assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 9) +assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 9) // We now switch to mobile mode. set-window-size: (600, 600) -wait-for-css: (".source-sidebar-expanded nav.sidebar", {"left": "0px"}) +wait-for-css: (".src-sidebar-expanded nav.sidebar", {"left": "0px"}) // We collapse the sidebar. click: (10, 10) // We check that the sidebar has been moved off-screen. assert-css: ("nav.sidebar", {"left": "-1000px"}) // We ensure that the class has been removed. -assert-false: ".source-sidebar-expanded" +assert-false: ".src-sidebar-expanded" assert: "nav.sidebar" // Check that the topbar is not visible diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index f8f73398d9b..f19e3ce80e1 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -98,26 +98,26 @@ assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) // First we "open" it. click: "#src-sidebar-toggle" -assert: ".source-sidebar-expanded" +assert: ".src-sidebar-expanded" // We check that the first entry of the sidebar is collapsed -assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) -assert-text: ("#source-sidebar details:first-of-type > summary", "extend_css") +assert-property: ("#src-sidebar details:first-of-type", {"open": "false"}) +assert-text: ("#src-sidebar details:first-of-type > summary", "extend_css") // We now click on it. -click: "#source-sidebar details:first-of-type > summary" -assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) +click: "#src-sidebar details:first-of-type > summary" +assert-property: ("#src-sidebar details:first-of-type", {"open": "true"}) // And now we collapse it again. -click: "#source-sidebar details:first-of-type > summary" -assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) +click: "#src-sidebar details:first-of-type > summary" +assert-property: ("#src-sidebar details:first-of-type", {"open": "false"}) // And open it again, since it'll be the reference we use to check positions. -click: "#source-sidebar details:first-of-type > summary" -assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) +click: "#src-sidebar details:first-of-type > summary" +assert-property: ("#src-sidebar details:first-of-type", {"open": "true"}) // Check the sidebar directory entries have a marker and spacing (desktop). store-property: ( - "#source-sidebar > details:first-of-type.dir-entry[open] > .files > a", + "#src-sidebar > details:first-of-type.dir-entry[open] > .files > a", {"offsetHeight": link_height}, ) define-function: ( @@ -125,28 +125,28 @@ define-function: ( (x, y), block { assert: "details:first-of-type.dir-entry[open] > summary::marker" - assert-css: ("#source-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"}) + assert-css: ("#src-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"}) // This check ensures that the summary is only one line. assert-property: ( - "#source-sidebar > details:first-of-type.dir-entry[open] > summary", + "#src-sidebar > details:first-of-type.dir-entry[open] > summary", {"offsetHeight": |link_height|} ) assert-position: ( - "#source-sidebar > details:first-of-type.dir-entry[open] > summary", + "#src-sidebar > details:first-of-type.dir-entry[open] > summary", {"x": |x|, "y": |y|} ) assert-property: ( - "#source-sidebar > details:first-of-type.dir-entry[open] > .files > a", + "#src-sidebar > details:first-of-type.dir-entry[open] > .files > a", {"offsetHeight": |link_height|} ) assert-position: ( - "#source-sidebar > details:first-of-type.dir-entry[open] > .files > a", + "#src-sidebar > details:first-of-type.dir-entry[open] > .files > a", // left margin {"x": |x| + 27, "y": |y| + |link_height|} ) } ) -store-property: ("#source-sidebar > .title", { +store-property: ("#src-sidebar > .title", { "offsetHeight": source_sidebar_title_height, "offsetTop": source_sidebar_title_y, }) @@ -175,7 +175,7 @@ assert-property: ("#main-content", {"offsetTop": 76}) // 21 = 76 - 34 - 21 // Check the sidebar directory entries have a marker and spacing (tablet). -store-property: ("#source-sidebar > .title", { +store-property: ("#src-sidebar > .title", { "offsetHeight": source_sidebar_title_height, "offsetTop": source_sidebar_title_y, }) @@ -189,7 +189,7 @@ set-window-size: (450, 700) assert-css: ("nav.sub", {"flex-direction": "column"}) // Check the sidebar directory entries have a marker and spacing (phone). -store-property: ("#source-sidebar > .title", { +store-property: ("#src-sidebar > .title", { "offsetHeight": source_sidebar_title_height, "offsetTop": source_sidebar_title_y, }) diff --git a/tests/rustdoc-gui/src-font-size.goml b/tests/rustdoc-gui/src-font-size.goml index ff30bcdf2a2..f23387d73d3 100644 --- a/tests/rustdoc-gui/src-font-size.goml +++ b/tests/rustdoc-gui/src-font-size.goml @@ -4,13 +4,13 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" show-text: true // Check the impl headers. -assert-css: (".impl .srclink", {"font-size": "16px", "font-weight": 400}, ALL) +assert-css: (".impl a.src", {"font-size": "16px", "font-weight": 400}, ALL) assert-css: (".impl .code-header", {"font-size": "18px", "font-weight": 600}, ALL) // Check the impl items. -assert-css: (".impl-items .srclink", {"font-size": "16px", "font-weight": 400}, ALL) +assert-css: (".impl-items a.src", {"font-size": "16px", "font-weight": 400}, ALL) assert-css: (".impl-items .code-header", {"font-size": "16px", "font-weight": 600}, ALL) // Check that we can click on source link store-document-property: {"URL": url} -click: ".impl-items .srclink" +click: ".impl-items a.src" assert-document-property-false: {"URL": |url|} diff --git a/tests/rustdoc/anchors.no_const_anchor.html b/tests/rustdoc/anchors.no_const_anchor.html index a8587829d3e..06673d87406 100644 --- a/tests/rustdoc/anchors.no_const_anchor.html +++ b/tests/rustdoc/anchors.no_const_anchor.html @@ -1 +1 @@ -sourceconst YOLO: u32 \ No newline at end of file +sourceconst YOLO: u32 \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_const_anchor2.html b/tests/rustdoc/anchors.no_const_anchor2.html index 4c5e45fea2d..73c3d0a807b 100644 --- a/tests/rustdoc/anchors.no_const_anchor2.html +++ b/tests/rustdoc/anchors.no_const_anchor2.html @@ -1 +1 @@ -sourcepub const X: i32 = 0i32 \ No newline at end of file +sourcepub const X: i32 = 0i32 \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_method_anchor.html b/tests/rustdoc/anchors.no_method_anchor.html index 44957a5b71a..e8b61caa1c1 100644 --- a/tests/rustdoc/anchors.no_method_anchor.html +++ b/tests/rustdoc/anchors.no_method_anchor.html @@ -1 +1 @@ -sourcepub fn new() -> Self \ No newline at end of file +sourcepub fn new() -> Self \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors.no_trait_method_anchor.html index 75c2caf87a8..abdb17c27dc 100644 --- a/tests/rustdoc/anchors.no_trait_method_anchor.html +++ b/tests/rustdoc/anchors.no_trait_method_anchor.html @@ -1 +1 @@ -sourcefn bar() \ No newline at end of file +sourcefn bar() \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors.no_tymethod_anchor.html index 38575eadfa9..23f4277c5b5 100644 --- a/tests/rustdoc/anchors.no_tymethod_anchor.html +++ b/tests/rustdoc/anchors.no_tymethod_anchor.html @@ -1 +1 @@ -sourcefn foo() \ No newline at end of file +sourcefn foo() \ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor.html b/tests/rustdoc/anchors.no_type_anchor.html index dd65d98fee6..62b9295508f 100644 --- a/tests/rustdoc/anchors.no_type_anchor.html +++ b/tests/rustdoc/anchors.no_type_anchor.html @@ -1 +1 @@ -sourcetype T \ No newline at end of file +sourcetype T \ No newline at end of file diff --git a/tests/rustdoc/ensure-src-link.rs b/tests/rustdoc/ensure-src-link.rs index c65387080f1..f99c4c4d988 100644 --- a/tests/rustdoc/ensure-src-link.rs +++ b/tests/rustdoc/ensure-src-link.rs @@ -2,5 +2,5 @@ // This test ensures that the [src] link is present on traits items. -// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="srclink rightside"]' "source" +// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="src rightside"]' "source" pub use std::iter::Iterator; diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs index 953563833c9..1c8d1573192 100644 --- a/tests/rustdoc/src-links-auto-impls.rs +++ b/tests/rustdoc/src-links-auto-impls.rs @@ -2,11 +2,11 @@ // @has foo/struct.Unsized.html // @has - '//*[@id="impl-Sized-for-Unsized"]/h3[@class="code-header"]' 'impl !Sized for Unsized' -// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="srclink"]' 'source' +// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source' // @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized' -// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="srclink"]' 'source' +// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source' // @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl Any for T' -// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink rightside"]' 'source' +// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source' pub struct Unsized { data: [u8], }