|
|
|
@ -37,7 +37,7 @@ describe ToolbarHelper, type: :helper do |
|
|
|
|
<div class="toolbar-container"> |
|
|
|
|
<div class="toolbar"> |
|
|
|
|
<div class="title-container"> |
|
|
|
|
<h2 title="Title">Title</h2> |
|
|
|
|
<h2>Title</h2> |
|
|
|
|
</div> |
|
|
|
|
<ul class="toolbar-items"></ul> |
|
|
|
|
</div> |
|
|
|
@ -51,7 +51,7 @@ describe ToolbarHelper, type: :helper do |
|
|
|
|
<div class="toolbar-container"> |
|
|
|
|
<div class="toolbar"> |
|
|
|
|
<div class="title-container"> |
|
|
|
|
<h2 title="Title">Title</h2> |
|
|
|
|
<h2>Title</h2> |
|
|
|
|
</div> |
|
|
|
|
<ul class="toolbar-items"></ul> |
|
|
|
|
</div> |
|
|
|
@ -60,6 +60,34 @@ describe ToolbarHelper, type: :helper do |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'should be able to add a link_to' do |
|
|
|
|
result = toolbar title: 'Title', link_to: link_to('foobar', user_path('1234')) |
|
|
|
|
expect(result).to be_html_eql %{ |
|
|
|
|
<div class="toolbar-container"> |
|
|
|
|
<div class="toolbar"> |
|
|
|
|
<div class="title-container"> |
|
|
|
|
<h2>Title: <a href="/users/1234">foobar</a></h2> |
|
|
|
|
</div> |
|
|
|
|
<ul class="toolbar-items"></ul> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'should escape the title' do |
|
|
|
|
result = toolbar title: '</h2><script>alert("foobar!");</script>' |
|
|
|
|
expect(result).to be_html_eql %{ |
|
|
|
|
<div class="toolbar-container"> |
|
|
|
|
<div class="toolbar"> |
|
|
|
|
<div class="title-container"> |
|
|
|
|
<h2></h2><script>alert("foobar!");</script></h2> |
|
|
|
|
</div> |
|
|
|
|
<ul class="toolbar-items"></ul> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'should include capsulate html' do |
|
|
|
|
result = toolbar title: 'Title' do |
|
|
|
|
content_tag :li do |
|
|
|
@ -70,7 +98,7 @@ describe ToolbarHelper, type: :helper do |
|
|
|
|
<div class="toolbar-container"> |
|
|
|
|
<div class="toolbar"> |
|
|
|
|
<div class="title-container"> |
|
|
|
|
<h2 title="Title">Title</h2> |
|
|
|
|
<h2>Title</h2> |
|
|
|
|
</div> |
|
|
|
|
<ul class="toolbar-items"> |
|
|
|
|
<li> |
|
|
|
|