|
8 | 8 | xmlns:e="http://github.com/oreillymedia/epubrenderer"
|
9 | 9 | stylesheet="../htmlbook.xsl">
|
10 | 10 |
|
| 11 | + <x:param name="autogenerate-toc" select="0"/> |
| 12 | + <x:param name="toc-placeholder-overwrite-contents" select="0"/> |
| 13 | + |
11 | 14 | <x:scenario label="When *empty* TOC nav element is matched">
|
12 | 15 | <x:context select="//h:nav[1]">
|
13 | 16 | <body>
|
|
18 | 21 | </section>
|
19 | 22 | </body>
|
20 | 23 | </x:context>
|
21 |
| - |
22 |
| - <x:scenario label="And autogenerate-toc param is *enabled*"> |
23 |
| - <x:context> |
24 |
| - <x:param name="autogenerate-toc" select="1"/> |
25 |
| - </x:context> |
26 |
| - <x:expect label="TOC content should be generated" |
27 |
| - test="count(h:nav[.//h:li[contains(., 'This chapter head should be in TOC')]]) = 1"/> |
28 |
| - </x:scenario> |
29 |
| - |
| 24 | + |
30 | 25 | <x:scenario label="And autogenerate-toc param is *disabled*">
|
31 | 26 | <x:context>
|
32 | 27 | <x:param name="autogenerate-toc" select="0"/>
|
|
35 | 30 | <nav data-type="toc" id="..."/>
|
36 | 31 | </x:expect>
|
37 | 32 | </x:scenario>
|
| 33 | + |
| 34 | + <x:scenario label="And autogenerate-toc param is *enabled*"> |
| 35 | + <x:context> |
| 36 | + <x:param name="autogenerate-toc" select="1"/> |
| 37 | + </x:context> |
| 38 | + <x:expect label="TOC content should be generated" |
| 39 | + test="count(h:nav[.//h:li[contains(., 'This chapter head should be in TOC')]]) = 1"/> |
| 40 | + </x:scenario> |
| 41 | + |
38 | 42 | </x:scenario>
|
39 |
| - |
40 |
| - <x:pending> |
41 | 43 |
|
42 | 44 | <x:scenario label="When *nonempty* TOC nav element is matched">
|
43 |
| - <x:context> |
| 45 | + <x:context select="//h:nav[1]"> |
44 | 46 | <body>
|
45 | 47 | <nav data-type="toc">
|
46 | 48 | <h1>Manual TOC</h1>
|
|
55 | 57 | <p>Go TOC!</p>
|
56 | 58 | </section>
|
57 | 59 | </body>
|
58 |
| - <x:param name=""/> |
59 | 60 | </x:context>
|
60 | 61 |
|
61 | 62 | <x:scenario label="And autogenerate-toc param is *disabled*">
|
62 |
| - <x:context/> |
63 |
| - <x:expect label="TOC content *should not* be generated (nav content left as is)"/> |
| 63 | + <x:context> |
| 64 | + <x:param name="autogenerate-toc" select="0"/> |
| 65 | + </x:context> |
| 66 | + <!-- Same as in context above, plus autogenerated id --> |
| 67 | + <x:expect label="TOC content *should not* be generated (nav content left as is)"> |
| 68 | + <nav id="..." data-type="toc"> |
| 69 | + <h1>Manual TOC</h1> |
| 70 | + <ol> |
| 71 | + <li>Entry 1</li> |
| 72 | + <li>Entry 2</li> |
| 73 | + <li>Entry 3</li> |
| 74 | + </ol> |
| 75 | + </nav> |
| 76 | + </x:expect> |
64 | 77 | </x:scenario>
|
65 | 78 |
|
66 | 79 | <x:scenario label="And autogenerate-toc param is *enabled*, but toc-placeholder-overwrite-contents is *disabled*">
|
67 |
| - <x:context/> |
68 |
| - <x:expect label="TOC content *should not* be generated (nav content left as is)"/> |
| 80 | + <x:context> |
| 81 | + <x:param name="autogenerate-toc" select="1"/> |
| 82 | + <x:param name="toc-placeholder-overwrite-contents" select="0"/> |
| 83 | + </x:context> |
| 84 | + <!-- Same as in context above, plus autogenerated id --> |
| 85 | + <x:expect label="TOC content *should not* be generated (nav content left as is)"> |
| 86 | + <nav id="..." data-type="toc"> |
| 87 | + <h1>Manual TOC</h1> |
| 88 | + <ol> |
| 89 | + <li>Entry 1</li> |
| 90 | + <li>Entry 2</li> |
| 91 | + <li>Entry 3</li> |
| 92 | + </ol> |
| 93 | + </nav> |
| 94 | + </x:expect> |
69 | 95 | </x:scenario>
|
70 | 96 |
|
71 | 97 | <x:scenario label="And autogenerate-toc param is *enabled*, and toc-placeholder-overwrite-contents is *enabled*">
|
72 |
| - <x:context/> |
73 |
| - <x:expect label="TOC content *should* be generated (nav content overwritten)"/> |
| 98 | + <x:context> |
| 99 | + <x:param name="autogenerate-toc" select="1"/> |
| 100 | + <x:param name="toc-placeholder-overwrite-contents" select="1"/> |
| 101 | + </x:context> |
| 102 | + <x:expect label="TOC content *should* be generated (nav content overwritten)" |
| 103 | + test="count(h:nav[.//h:li[contains(., 'This chapter head should be in TOC')]]) = 1 and |
| 104 | + not(exists(h:nav//h:h1[contains(., 'Manual TOC')]))"/> |
74 | 105 | </x:scenario>
|
75 | 106 | </x:scenario>
|
| 107 | + |
| 108 | + <x:pending> |
76 | 109 |
|
| 110 | + <!-- How many combinations of empty/nonempty nav, autogenerate-toc, and toc-placeholder-overwrite-contents do we need to do here? --> |
77 | 111 | <x:scenario label="When there are multiple TOC nav elements">
|
78 | 112 | <x:context>
|
79 | 113 | <body>
|
80 | 114 | <nav data-type="toc"/>
|
81 | 115 | <nav data-type="toc"/>
|
82 | 116 | </body>
|
83 | 117 | </x:context>
|
84 |
| - <x:expect label="Process them all per the same params"/> |
| 118 | + <x:expect label="Process them all the same way"/> |
85 | 119 | </x:scenario>
|
86 | 120 |
|
87 | 121 | <x:scenario label="When a TOC is generated with a scope specified">
|
|
0 commit comments