File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ # serializer version: 1
2
+ # name: test_builder_generate_sidebar
3
+ '''
4
+ website:
5
+ sidebar:
6
+ contents:
7
+ - reference/index.qmd
8
+ - contents:
9
+ - reference/a_func.qmd
10
+ section: first section
11
+ - contents:
12
+ - contents:
13
+ - reference/a_attr.qmd
14
+ section: a subsection
15
+ section: second section
16
+ id: reference
17
+
18
+ '''
19
+ # ---
Original file line number Diff line number Diff line change 1
1
import pytest
2
+ import yaml
2
3
3
4
from pathlib import Path
4
5
from quartodoc import layout as lo
5
- from quartodoc import Builder
6
+ from quartodoc import Builder , blueprint
6
7
7
8
8
9
@pytest .fixture
@@ -40,3 +41,28 @@ def test_builder_build_filter_wildcard_methods(builder):
40
41
builder .build (filter = "MdRenderer.*" )
41
42
42
43
len (list (Path (builder .dir ).glob ("Mdrenderer.*" ))) == 2
44
+
45
+
46
+ def test_builder_generate_sidebar (tmp_path , snapshot ):
47
+ cfg = yaml .safe_load (
48
+ """
49
+ quartodoc:
50
+ package: quartodoc.tests.example
51
+ sections:
52
+ - title: first section
53
+ desc: some description
54
+ contents: [a_func]
55
+ - title: second section
56
+ desc: title description
57
+ - subtitle: a subsection
58
+ desc: subtitle description
59
+ contents:
60
+ - a_attr
61
+ """
62
+ )
63
+
64
+ builder = Builder .from_quarto_config (cfg )
65
+ bp = blueprint (builder .layout )
66
+ d_sidebar = builder ._generate_sidebar (bp )
67
+
68
+ assert yaml .dump (d_sidebar ) == snapshot
You can’t perform that action at this time.
0 commit comments