@@ -367,15 +367,12 @@ def test_html_style(app):
367
367
@pytest .mark .sphinx (
368
368
'html' ,
369
369
testroot = 'basic' ,
370
- # alabaster changed default sidebars in 1.0.0
371
370
confoverrides = {
372
371
'html_sidebars' : {
373
372
'**' : [
374
- 'about.html' ,
375
- 'navigation.html' ,
376
- 'relations.html' ,
377
- 'searchbox.html' ,
378
- 'donate.html' ,
373
+ 'localtoc.html' ,
374
+ 'searchfield.html' ,
375
+ 'sourcelink.html' ,
379
376
]
380
377
}
381
378
},
@@ -386,45 +383,58 @@ def test_html_sidebar(app):
386
383
# default for alabaster
387
384
app .build (force_all = True )
388
385
result = (app .outdir / 'index.html' ).read_text (encoding = 'utf8' )
386
+ # layout.html
389
387
assert '<div class="sphinxsidebar" role="navigation" aria-label="Main">' in result
390
- assert '<h1 class="logo"><a href="#">Project name not set</a></h1> ' in result
388
+ assert '<h1>The basic Sphinx documentation for testing ' in result
391
389
assert '<h3>Navigation</h3>' in result
392
- assert '<h3>Related Topics</h3>' in result
393
- assert '<h3 id="searchlabel">Quick search</h3>' in result
390
+ # localtoc.html
391
+ assert '<h3><a href="#">Table of Contents</a></h3>' in result
392
+ # searchfield.html
393
+ assert '<div class="searchformwrapper">' in result
394
+ # sourcelink.html
395
+ assert '<h3>This Page</h3>' in result
394
396
395
397
app .builder .add_sidebars ('index' , ctx )
396
398
assert ctx ['sidebars' ] == [
397
- 'about.html' ,
398
- 'navigation.html' ,
399
- 'relations.html' ,
400
- 'searchbox.html' ,
401
- 'donate.html' ,
399
+ 'localtoc.html' ,
400
+ 'searchfield.html' ,
401
+ 'sourcelink.html' ,
402
402
]
403
403
404
- # only relations .html
405
- app .config .html_sidebars = {'**' : ['relations .html' ]}
404
+ # only sourcelink .html
405
+ app .config .html_sidebars = {'**' : ['sourcelink .html' ]}
406
406
app .build (force_all = True )
407
407
result = (app .outdir / 'index.html' ).read_text (encoding = 'utf8' )
408
+ # layout.html
408
409
assert '<div class="sphinxsidebar" role="navigation" aria-label="Main">' in result
409
- assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
410
- assert '<h3>Navigation</h3>' not in result
411
- assert '<h3>Related Topics</h3>' in result
412
- assert '<h3 id="searchlabel">Quick search</h3>' not in result
410
+ assert '<h1>The basic Sphinx documentation for testing' in result
411
+ assert '<h3>Navigation</h3>' in result
412
+ # localtoc.html
413
+ assert '<h3><a href="#">Table of Contents</a></h3>' not in result
414
+ # searchfield.html
415
+ assert '<div class="searchformwrapper">' not in result
416
+ # sourcelink.html
417
+ assert '<h3>This Page</h3>' in result
413
418
414
419
app .builder .add_sidebars ('index' , ctx )
415
- assert ctx ['sidebars' ] == ['relations .html' ]
420
+ assert ctx ['sidebars' ] == ['sourcelink .html' ]
416
421
417
422
# no sidebars
418
423
app .config .html_sidebars = {'**' : []}
419
424
app .build (force_all = True )
420
425
result = (app .outdir / 'index.html' ).read_text (encoding = 'utf8' )
426
+ # layout.html
421
427
assert (
422
428
'<div class="sphinxsidebar" role="navigation" aria-label="Main">'
423
429
) not in result
424
- assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
425
- assert '<h3>Navigation</h3>' not in result
426
- assert '<h3>Related Topics</h3>' not in result
427
- assert '<h3 id="searchlabel">Quick search</h3>' not in result
430
+ assert '<h1>The basic Sphinx documentation for testing' in result
431
+ assert '<h3>Navigation</h3>' in result
432
+ # localtoc.html
433
+ assert '<h3><a href="#">Table of Contents</a></h3>' not in result
434
+ # searchfield.html
435
+ assert '<div class="searchformwrapper">' not in result
436
+ # sourcelink.html
437
+ assert '<h3>This Page</h3>' not in result
428
438
429
439
app .builder .add_sidebars ('index' , ctx )
430
440
assert ctx ['sidebars' ] == []
0 commit comments