@@ -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.
@@ -179,3 +179,36 @@ assert-property: (".sidebar .sidebar-crate h2 a", {
179179 "offsetTop": |index_sidebar_y|,
180180 "offsetLeft": |index_sidebar_x|,
181181})
182+
183+ // Configuration option to show TOC in sidebar.
184+ set-local-storage: {"rustdoc-hide-toc": "true"}
185+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
186+ assert-css: ("#TOC", {"display": "none"})
187+ assert-css: (".sidebar .in-crate", {"display": "none"})
188+ set-local-storage: {"rustdoc-hide-toc": "false"}
189+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
190+ assert-css: ("#TOC", {"display": "block"})
191+ assert-css: (".sidebar .in-crate", {"display": "block"})
192+
193+ set-local-storage: {"rustdoc-hide-modnav": "true"}
194+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
195+ assert-css: ("#ModNav", {"display": "none"})
196+ set-local-storage: {"rustdoc-hide-modnav": "false"}
197+ go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
198+ assert-css: ("#ModNav", {"display": "block"})
199+
200+ set-local-storage: {"rustdoc-hide-toc": "true"}
201+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
202+ assert-css: ("#TOC", {"display": "none"})
203+ assert-false: ".sidebar .in-crate"
204+ set-local-storage: {"rustdoc-hide-toc": "false"}
205+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
206+ assert-css: ("#TOC", {"display": "block"})
207+ assert-false: ".sidebar .in-crate"
208+
209+ set-local-storage: {"rustdoc-hide-modnav": "true"}
210+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
211+ assert-css: ("#ModNav", {"display": "none"})
212+ set-local-storage: {"rustdoc-hide-modnav": "false"}
213+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
214+ assert-css: ("#ModNav", {"display": "block"})
0 commit comments