@@ -123,8 +123,8 @@ assert-count: (".sidebar .location", 1)
123123// - Module name, followed by TOC for module headings
124124// - "In crate [name]" parent pointer, followed by sibling navigation
125125assert-count: (".sidebar h2", 3)
126- assert-text: (".sidebar > .sidebar-elems > h2", "In crate lib2")
127- assert-property: (".sidebar > .sidebar-elems > h2 > a", {
126+ assert-text: (".sidebar > .sidebar-elems > #ModNav > h2", "In crate lib2")
127+ assert-property: (".sidebar > .sidebar-elems > #ModNav > h2 > a", {
128128 "href": "/lib2/index.html",
129129}, ENDS_WITH)
130130// We check that we don't have the crate list.
@@ -134,8 +134,8 @@ go-to: "./sub_module/sub_sub_module/index.html"
134134assert-property: (".sidebar", {"clientWidth": "200"})
135135assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
136136assert-text: (".sidebar .location", "Module sub_sub_module")
137- assert-text: (".sidebar > .sidebar-elems > h2", "In lib2::module::sub_module")
138- assert-property: (".sidebar > .sidebar-elems > h2 > a", {
137+ assert-text: (".sidebar > .sidebar-elems > #ModNav > h2", "In lib2::module::sub_module")
138+ assert-property: (".sidebar > .sidebar-elems > #ModNav > h2 > a", {
139139 "href": "/module/sub_module/index.html",
140140}, ENDS_WITH)
141141// We check that we don't have the crate list.
@@ -194,3 +194,36 @@ assert-position-false: (".sidebar-crate > h2 > a", {"x": -3})
194194// when line-wrapped, see that it becomes flush-left again
195195drag-and-drop: ((205, 100), (108, 100))
196196assert-position: (".sidebar-crate > h2 > a", {"x": -3})
197+
198+ // Configuration option to show TOC in sidebar.
199+ set-local-storage: {"rustdoc-hide-toc": "true"}
200+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
201+ assert-css: ("#TOC", {"display": "none"})
202+ assert-css: (".sidebar .in-crate", {"display": "none"})
203+ set-local-storage: {"rustdoc-hide-toc": "false"}
204+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
205+ assert-css: ("#TOC", {"display": "block"})
206+ assert-css: (".sidebar .in-crate", {"display": "block"})
207+
208+ set-local-storage: {"rustdoc-hide-modnav": "true"}
209+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
210+ assert-css: ("#ModNav", {"display": "none"})
211+ set-local-storage: {"rustdoc-hide-modnav": "false"}
212+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
213+ assert-css: ("#ModNav", {"display": "block"})
214+
215+ set-local-storage: {"rustdoc-hide-toc": "true"}
216+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
217+ assert-css: ("#TOC", {"display": "none"})
218+ assert-false: ".sidebar .in-crate"
219+ set-local-storage: {"rustdoc-hide-toc": "false"}
220+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
221+ assert-css: ("#TOC", {"display": "block"})
222+ assert-false: ".sidebar .in-crate"
223+
224+ set-local-storage: {"rustdoc-hide-modnav": "true"}
225+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
226+ assert-css: ("#ModNav", {"display": "none"})
227+ set-local-storage: {"rustdoc-hide-modnav": "false"}
228+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
229+ assert-css: ("#ModNav", {"display": "block"})
0 commit comments