@@ -45,6 +45,7 @@ def test_toc_visibility(sphinx_build_factory) -> None:
45
45
"""Test that setting TOC level visibility works as expected."""
46
46
confoverrides = {
47
47
"html_theme_options.show_toc_level" : 2 ,
48
+ "html_theme_options.navigation_with_keys" : False ,
48
49
}
49
50
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
50
51
index_html = sphinx_build .html_tree ("index.html" )
@@ -57,6 +58,7 @@ def test_toc_visibility(sphinx_build_factory) -> None:
57
58
def test_icon_links (sphinx_build_factory , file_regression ) -> None :
58
59
"""Test that setting icon links are rendered in the documentation."""
59
60
html_theme_options_icon_links = {
61
+ "navigation_with_keys" : False ,
60
62
"icon_links" : [
61
63
{
62
64
"name" : "FONTAWESOME" ,
@@ -103,7 +105,7 @@ def test_icon_links(sphinx_build_factory, file_regression) -> None:
103
105
"class" : "overridden classes" ,
104
106
},
105
107
},
106
- ]
108
+ ],
107
109
}
108
110
confoverrides = {"html_theme_options" : html_theme_options_icon_links }
109
111
@@ -125,6 +127,10 @@ def test_icon_links(sphinx_build_factory, file_regression) -> None:
125
127
)
126
128
def test_logo_alt_text (sphinx_build_factory , confoverrides , expected_alt_text ) -> None :
127
129
"""Test our alt-text fallback mechanism."""
130
+ confoverrides ["html_theme_options" ] = (
131
+ confoverrides .get ("html_theme_options" , False ) or dict ()
132
+ )
133
+ confoverrides ["html_theme_options" ].update ({"navigation_with_keys" : False })
128
134
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
129
135
index_html = sphinx_build .html_tree ("index.html" )
130
136
logo_image = index_html .select (".navbar-brand img" )[0 ]
@@ -144,7 +150,10 @@ def test_logo_basic(sphinx_build_factory) -> None:
144
150
145
151
def test_logo_no_image (sphinx_build_factory ) -> None :
146
152
"""Test that the text is shown if no image specified."""
147
- confoverrides = {"html_logo" : "" }
153
+ confoverrides = {
154
+ "html_logo" : "" ,
155
+ "html_theme_options.navigation_with_keys" : False ,
156
+ }
148
157
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
149
158
index_html = sphinx_build .html_tree ("index.html" )
150
159
assert "PyData Tests" in index_html .select (".navbar-brand" )[0 ].text .strip ()
@@ -156,10 +165,11 @@ def test_logo_two_images(sphinx_build_factory) -> None:
156
165
# Test with a specified title and a dark logo
157
166
confoverrides = {
158
167
"html_theme_options" : {
168
+ "navigation_with_keys" : False ,
159
169
"logo" : {
160
170
"text" : "Foo Title" ,
161
171
"image_dark" : "_static/emptydarklogo.png" ,
162
- }
172
+ },
163
173
},
164
174
}
165
175
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
@@ -175,6 +185,7 @@ def test_primary_logo_is_light_when_no_default_mode(sphinx_build_factory) -> Non
175
185
# Ensure no default mode is set
176
186
confoverrides = {
177
187
"html_context" : {},
188
+ "html_theme_options.navigation_with_keys" : False ,
178
189
}
179
190
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
180
191
index_html = sphinx_build .html_tree ("index.html" )
@@ -190,6 +201,7 @@ def test_primary_logo_is_light_when_default_mode_is_set_to_auto(
190
201
# Ensure no default mode is set
191
202
confoverrides = {
192
203
"html_context" : {"default_mode" : "auto" },
204
+ "html_theme_options.navigation_with_keys" : False ,
193
205
}
194
206
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
195
207
index_html = sphinx_build .html_tree ("index.html" )
@@ -203,6 +215,7 @@ def test_primary_logo_is_light_when_default_mode_is_light(sphinx_build_factory)
203
215
# Ensure no default mode is set
204
216
confoverrides = {
205
217
"html_context" : {"default_mode" : "light" },
218
+ "html_theme_options.navigation_with_keys" : False ,
206
219
}
207
220
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
208
221
index_html = sphinx_build .html_tree ("index.html" )
@@ -216,6 +229,7 @@ def test_primary_logo_is_dark_when_default_mode_is_dark(sphinx_build_factory) ->
216
229
# Ensure no default mode is set
217
230
confoverrides = {
218
231
"html_context" : {"default_mode" : "dark" },
232
+ "html_theme_options.navigation_with_keys" : False ,
219
233
}
220
234
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
221
235
index_html = sphinx_build .html_tree ("index.html" )
@@ -229,10 +243,11 @@ def test_logo_missing_image(sphinx_build_factory) -> None:
229
243
# Test with a specified title and a dark logo
230
244
confoverrides = {
231
245
"html_theme_options" : {
246
+ "navigation_with_keys" : False ,
232
247
"logo" : {
233
248
# The logo is actually in _static
234
249
"image_dark" : "emptydarklogo.png" ,
235
- }
250
+ },
236
251
},
237
252
}
238
253
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build (
@@ -247,9 +262,10 @@ def test_logo_external_link(sphinx_build_factory) -> None:
247
262
test_url = "https://secure.example.com"
248
263
confoverrides = {
249
264
"html_theme_options" : {
265
+ "navigation_with_keys" : False ,
250
266
"logo" : {
251
267
"link" : test_url ,
252
- }
268
+ },
253
269
},
254
270
}
255
271
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
@@ -264,9 +280,10 @@ def test_logo_external_image(sphinx_build_factory) -> None:
264
280
test_url = "https://pydata.org/wp-content/uploads/2019/06/pydata-logo-final.png"
265
281
confoverrides = {
266
282
"html_theme_options" : {
283
+ "navigation_with_keys" : False ,
267
284
"logo" : {
268
285
"image_dark" : test_url ,
269
- }
286
+ },
270
287
},
271
288
}
272
289
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
@@ -280,9 +297,10 @@ def test_logo_template_rejected(sphinx_build_factory) -> None:
280
297
# Test with a specified external logo image source
281
298
confoverrides = {
282
299
"html_theme_options" : {
300
+ "navigation_with_keys" : False ,
283
301
"logo" : {
284
302
"image_dark" : "image_dark_t" ,
285
- }
303
+ },
286
304
},
287
305
}
288
306
with pytest .raises (sphinx .errors .ExtensionError , match = "static logo image" ):
@@ -299,7 +317,10 @@ def test_logo_template_rejected(sphinx_build_factory) -> None:
299
317
)
300
318
def test_navbar_align (align , klass , sphinx_build_factory ) -> None :
301
319
"""The navbar items align with the proper part of the page."""
302
- confoverrides = {"html_theme_options.navbar_align" : align }
320
+ confoverrides = {
321
+ "html_theme_options.navbar_align" : align ,
322
+ "html_theme_options.navigation_with_keys" : False ,
323
+ }
303
324
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
304
325
index_html = sphinx_build .html_tree ("index.html" )
305
326
if klass [0 ]:
@@ -329,6 +350,7 @@ def test_navbar_header_dropdown(sphinx_build_factory, n_links) -> None:
329
350
330
351
confoverrides = {
331
352
"html_theme_options" : {
353
+ "navigation_with_keys" : False ,
332
354
"external_links" : extra_links ,
333
355
"header_links_before_dropdown" : n_links ,
334
356
}
@@ -355,13 +377,15 @@ def test_navbar_header_dropdown_button(sphinx_build_factory, dropdown_text) -> N
355
377
if dropdown_text :
356
378
confoverrides = {
357
379
"html_theme_options" : {
380
+ "navigation_with_keys" : False ,
358
381
"header_links_before_dropdown" : 2 ,
359
382
"header_dropdown_text" : dropdown_text ,
360
383
}
361
384
}
362
385
else :
363
386
confoverrides = {
364
387
"html_theme_options" : {
388
+ "navigation_with_keys" : False ,
365
389
"header_links_before_dropdown" : 2 ,
366
390
}
367
391
}
@@ -401,7 +425,10 @@ def test_sidebars_nested_page(sphinx_build_factory, file_regression) -> None:
401
425
402
426
def test_sidebars_level2 (sphinx_build_factory , file_regression ) -> None :
403
427
"""Test sidebars in a second-level page w/ children."""
404
- confoverrides = {"templates_path" : ["_templates_sidebar_level2" ]}
428
+ confoverrides = {
429
+ "templates_path" : ["_templates_sidebar_level2" ],
430
+ "html_theme_options.navigation_with_keys" : False ,
431
+ }
405
432
sphinx_build = sphinx_build_factory ("sidebars" , confoverrides = confoverrides ).build ()
406
433
407
434
subindex_html = sphinx_build .html_tree ("section1/subsection1/index.html" )
@@ -416,7 +443,10 @@ def test_sidebars_show_nav_level0(sphinx_build_factory) -> None:
416
443
417
444
Testing both home page and a subsection page for correct elements.
418
445
"""
419
- confoverrides = {"html_theme_options.show_nav_level" : 0 }
446
+ confoverrides = {
447
+ "html_theme_options.show_nav_level" : 0 ,
448
+ "html_theme_options.navigation_with_keys" : False ,
449
+ }
420
450
sphinx_build = sphinx_build_factory ("sidebars" , confoverrides = confoverrides ).build ()
421
451
422
452
# 1. Home Page
@@ -611,6 +641,7 @@ def test_footer(sphinx_build_factory) -> None:
611
641
def test_edit_page_url (sphinx_build_factory , html_context , edit_text_and_url ) -> None :
612
642
"""Test the edit this page generated link."""
613
643
confoverrides = {
644
+ "html_theme_options.navigation_with_keys" : False ,
614
645
"html_theme_options.use_edit_page_button" : True ,
615
646
"html_context" : html_context ,
616
647
}
@@ -659,6 +690,7 @@ def test_edit_page_url(sphinx_build_factory, html_context, edit_text_and_url) ->
659
690
def test_analytics (sphinx_build_factory , provider , tags ) -> None :
660
691
"""Check the Google analytics."""
661
692
confoverrides = provider
693
+ confoverrides .update ({"html_theme_options.navigation_with_keys" : False })
662
694
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides )
663
695
sphinx_build .build ()
664
696
index_html = sphinx_build .html_tree ("index.html" )
@@ -674,10 +706,11 @@ def test_analytics(sphinx_build_factory, provider, tags) -> None:
674
706
def test_plausible (sphinx_build_factory ) -> None :
675
707
"""Test the Plausible analytics."""
676
708
provider = {
709
+ "html_theme_options.navigation_with_keys" : False ,
677
710
"html_theme_options.analytics" : {
678
711
"plausible_analytics_domain" : "toto" ,
679
712
"plausible_analytics_url" : "http://.../script.js" ,
680
- }
713
+ },
681
714
}
682
715
confoverrides = provider
683
716
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides )
@@ -694,7 +727,10 @@ def test_plausible(sphinx_build_factory) -> None:
694
727
695
728
def test_show_nav_level (sphinx_build_factory ) -> None :
696
729
"""The navbar items align with the proper part of the page."""
697
- confoverrides = {"html_theme_options.show_nav_level" : 2 }
730
+ confoverrides = {
731
+ "html_theme_options.navigation_with_keys" : False ,
732
+ "html_theme_options.show_nav_level" : 2 ,
733
+ }
698
734
sphinx_build = sphinx_build_factory ("sidebars" , confoverrides = confoverrides ).build ()
699
735
700
736
# Both the column alignment and the margin should be changed
@@ -722,6 +758,7 @@ def test_version_switcher_error_states(
722
758
"""
723
759
confoverrides = {
724
760
"html_theme_options" : {
761
+ "navigation_with_keys" : False ,
725
762
"navbar_end" : ["version-switcher" ],
726
763
"switcher" : {
727
764
"json_url" : url ,
@@ -799,6 +836,7 @@ def test_pygments_fallbacks(sphinx_build_factory, style_names, keyword_colors) -
799
836
"""
800
837
confoverrides = {
801
838
"html_theme_options" : {
839
+ "navigation_with_keys" : False ,
802
840
"pygment_light_style" : style_names [0 ],
803
841
"pygment_dark_style" : style_names [1 ],
804
842
},
@@ -845,6 +883,7 @@ def test_deprecated_build_html(sphinx_build_factory, file_regression) -> None:
845
883
warnings = sphinx_build .warnings .strip ("\n " ).split ("\n " )
846
884
warnings = [w .lstrip ("\x1b [91m" ).rstrip ("\x1b [39;49;00m\n " ) for w in warnings ]
847
885
expected_warnings = (
886
+ "The default value for `navigation_with_keys` will change" ,
848
887
"The configuration `logo_text` is deprecated" ,
849
888
"The configuration `favicons` is deprecated." ,
850
889
"`footer_items` is deprecated" ,
@@ -881,6 +920,7 @@ def test_empty_templates(sphinx_build_factory) -> None:
881
920
# When configured to be gone, the template should be removed w/ its parent.
882
921
# ABlog needs to be added so we can test that template rendering works w/ it.
883
922
confoverrides = {
923
+ "html_theme_options.navigation_with_keys" : False ,
884
924
"html_show_sourcelink" : False ,
885
925
}
886
926
sphinx_build = sphinx_build_factory ("base" , confoverrides = confoverrides ).build ()
@@ -910,6 +950,7 @@ def test_translations(sphinx_build_factory) -> None:
910
950
"github_version" : "main" ,
911
951
},
912
952
"html_theme_options" : {
953
+ "navigation_with_keys" : False ,
913
954
"use_edit_page_button" : True ,
914
955
},
915
956
}
0 commit comments