|
|
@ -573,39 +573,83 @@ WIKI_TEXT |
|
|
|
|
|
|
|
|
|
|
|
subject(:html) { format_text(wiki_text) } |
|
|
|
subject(:html) { format_text(wiki_text) } |
|
|
|
|
|
|
|
|
|
|
|
it 'emits a table of contents for headings h1-h4' do |
|
|
|
context 'w/ request present' do |
|
|
|
expect(html).to be_html_eql(%{ |
|
|
|
let(:request) { ActionController::TestRequest.new } |
|
|
|
<fieldset class='form--fieldset -collapsible'> |
|
|
|
let(:url_for) { '/test' } |
|
|
|
<legend class='form--fieldset-legend' title='Show/Hide table of contents' onclick='toggleFieldset(this);'> |
|
|
|
|
|
|
|
<a href='javascript:'>Table of Contents</a> |
|
|
|
it 'emits a table of contents for headings h1-h4 with links present' do |
|
|
|
</legend> |
|
|
|
expect(html).to be_html_eql(%{ |
|
|
|
<div> |
|
|
|
<fieldset class='form--fieldset -collapsible'> |
|
|
|
<ul class="toc"> |
|
|
|
<legend class='form--fieldset-legend' title='Show/Hide table of contents' onclick='toggleFieldset(this);'> |
|
|
|
<li> |
|
|
|
<a href='javascript:'>Table of Contents</a> |
|
|
|
<a href="#Orange">Orange</a> |
|
|
|
</legend> |
|
|
|
<ul> |
|
|
|
<div> |
|
|
|
<li> |
|
|
|
<ul class="toc"> |
|
|
|
<a href="#Varietes">Varietes</a> |
|
|
|
<li> |
|
|
|
<ul> |
|
|
|
<a href="/test#Orange">Orange</a> |
|
|
|
<li> |
|
|
|
<ul> |
|
|
|
<a href="#Common-Oranges">Common Oranges</a> |
|
|
|
<li> |
|
|
|
<ul> |
|
|
|
<a href="/test#Varietes">Varietes</a> |
|
|
|
<li><a href="#Valencia">Valencia</a></li> |
|
|
|
<ul> |
|
|
|
<li><a href="#Harts-Tardiff-Valencia">Hart's Tardiff Valencia</a></li> |
|
|
|
<li> |
|
|
|
</ul> |
|
|
|
<a href="/test#Common-Oranges">Common Oranges</a> |
|
|
|
</li> |
|
|
|
<ul> |
|
|
|
<li><a href="#Navel-Oranges">Navel Oranges</a></li> |
|
|
|
<li><a href="/test#Valencia">Valencia</a></li> |
|
|
|
<li><a href="#Blood-Oranges">Blood Oranges</a></li> |
|
|
|
<li><a href="/test#Harts-Tardiff-Valencia">Hart's Tardiff Valencia</a></li> |
|
|
|
<li><a href="#Acidless-Oranges">Acidless Oranges</a></li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
<li><a href="/test#Navel-Oranges">Navel Oranges</a></li> |
|
|
|
<li><a href="#Attributes">Attributes</a></li> |
|
|
|
<li><a href="/test#Blood-Oranges">Blood Oranges</a></li> |
|
|
|
</ul> |
|
|
|
<li><a href="/test#Acidless-Oranges">Acidless Oranges</a></li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</li> |
|
|
|
</div> |
|
|
|
<li><a href="/test#Attributes">Attributes</a></li> |
|
|
|
</fieldset> |
|
|
|
</ul> |
|
|
|
}).at_path('fieldset') |
|
|
|
</li> |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</fieldset> |
|
|
|
|
|
|
|
}).at_path('fieldset') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'w/o request present' do |
|
|
|
|
|
|
|
let(:request) { nil } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'emits a table of contents for headings h1-h4 with anchors' do |
|
|
|
|
|
|
|
expect(html).to be_html_eql(%{ |
|
|
|
|
|
|
|
<fieldset class='form--fieldset -collapsible'> |
|
|
|
|
|
|
|
<legend class='form--fieldset-legend' title='Show/Hide table of contents' onclick='toggleFieldset(this);'> |
|
|
|
|
|
|
|
<a href='javascript:'>Table of Contents</a> |
|
|
|
|
|
|
|
</legend> |
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
|
|
<ul class="toc"> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<a href="#Orange">Orange</a> |
|
|
|
|
|
|
|
<ul> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<a href="#Varietes">Varietes</a> |
|
|
|
|
|
|
|
<ul> |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<a href="#Common-Oranges">Common Oranges</a> |
|
|
|
|
|
|
|
<ul> |
|
|
|
|
|
|
|
<li><a href="#Valencia">Valencia</a></li> |
|
|
|
|
|
|
|
<li><a href="#Harts-Tardiff-Valencia">Hart's Tardiff Valencia</a></li> |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
<li><a href="#Navel-Oranges">Navel Oranges</a></li> |
|
|
|
|
|
|
|
<li><a href="#Blood-Oranges">Blood Oranges</a></li> |
|
|
|
|
|
|
|
<li><a href="#Acidless-Oranges">Acidless Oranges</a></li> |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
<li><a href="#Attributes">Attributes</a></li> |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</fieldset> |
|
|
|
|
|
|
|
}).at_path('fieldset') |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|