about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-30 04:15:10 +0000
committerbors <bors@rust-lang.org>2022-05-30 04:15:10 +0000
commit855fc022fe879f4e3493a024f9c6b981d6317612 (patch)
treec988df429b7e61bb40fbba5a46b56af39faa7ef6 /src
parent6999ef25645dcfcfd4e7092e448385ab3b73e44c (diff)
parentbfb16b9dd7f25dcbf37dec47cf6abf057446588d (diff)
downloadrust-855fc022fe879f4e3493a024f9c6b981d6317612.tar.gz
rust-855fc022fe879f4e3493a024f9c6b981d6317612.zip
Auto merge of #97489 - GuillaumeGomez:settings-js-disabled, r=notriddle
Add sentence in case JS is disabled on settings.html page

Instead of having an empty page, it'll look like this:

![Screenshot from 2022-05-28 17-46-23](https://user-images.githubusercontent.com/3050060/170833333-e1a59c2b-27ca-47da-9c08-2356e4a689cb.png)

r? `@notriddle`
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/context.rs5
-rw-r--r--src/test/rustdoc-gui/settings.goml6
2 files changed, 11 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index c5dbf8aa754..68e2f0cf9c0 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -609,6 +609,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
                         </a>\
                      </span>\
                      </div>\
+                     <noscript>\
+                        <section>\
+                            You need to enable Javascript be able to update your settings.\
+                        </section>\
+                     </noscript>\
                      <link rel=\"stylesheet\" type=\"text/css\" \
                          href=\"{root_path}settings{suffix}.css\">\
                      <script defer src=\"{root_path}settings{suffix}.js\"></script>",
diff --git a/src/test/rustdoc-gui/settings.goml b/src/test/rustdoc-gui/settings.goml
index 1b2d1e31f52..cbfc67e7906 100644
--- a/src/test/rustdoc-gui/settings.goml
+++ b/src/test/rustdoc-gui/settings.goml
@@ -65,3 +65,9 @@ assert-local-storage: {"rustdoc-disable-shortcuts": "true"}
 goto: file://|DOC_PATH|/settings.html
 wait-for: "#settings"
 assert-css: (".setting-line .toggle .slider", {"width": "45px", "margin-right": "20px"})
+
+// We now check the display with JS disabled.
+assert-false: "noscript section"
+javascript: false
+reload:
+assert-css: ("noscript section", {"display": "block"})