Permalink
Browse files

Merge pull request #9 from gucki/wrap_legend_in_span

wrap legend text in span to better comply with formtastic and allow bette
  • Loading branch information...
2 parents a4413a8 + 545e4ff commit f0e9e6ae480df4ffbe300d976dd0638affb8d90d @MBO committed Jun 25, 2011
Showing with 15 additions and 13 deletions.
  1. +3 −1 lib/attrtastic/semantic_attributes_builder.rb
  2. +8 −8 test/test_attributes.rb
  3. +4 −4 test/test_attrtastic.rb
@@ -299,7 +299,9 @@ def attributes_for(object, methods, options, &block)
header = options[:name]
if header.present?
- output << template.content_tag(:div, header, :class => html_header_class)
+ output << template.content_tag(:div, :class => html_header_class) do
+ template.content_tag(:span, header)
+ end
end
if block_given?
View
@@ -42,7 +42,7 @@ class TestAttributes < TestCase
should "show header" do
expected = html <<-EOHTML
<div class="attributes">
- <div class="legend">Legend</div>
+ <div class="legend"><span>Legend</span></div>
<ol>
</ol>
</div>
@@ -82,7 +82,7 @@ class TestAttributes < TestCase
should "show header" do
expected = html <<-EOHTML
<div class="attributes contact">
- <div class="legend">Contact</div>
+ <div class="legend"><span>Contact</span></div>
<ol>
<li class="attribute">
<span class="label">Full name</span>
@@ -157,7 +157,7 @@ class TestAttributes < TestCase
should "show header" do
expected = html <<-EOHTML
<div class="attributes user">
- <div class="legend">Author</div>
+ <div class="legend"><span>Author</span></div>
<ol>
</ol>
</div>
@@ -227,7 +227,7 @@ class TestAttributes < TestCase
expected = html <<-EOHTML
<div class="attributes user">
- <div class="legend">Author</div>
+ <div class="legend"><span>Author</span></div>
<ol>
</ol>
</div>
@@ -287,12 +287,12 @@ class TestAttributes < TestCase
should "show header" do
expected = html <<-EOHTML
<div class="attributes post">
- <div class="legend">Post</div>
+ <div class="legend"><span>Post</span></div>
<ol>
</ol>
</div>
<div class="attributes post">
- <div class="legend">Post</div>
+ <div class="legend"><span>Post</span></div>
<ol>
</ol>
</div>
@@ -362,12 +362,12 @@ class TestAttributes < TestCase
should "show header" do
expected = html <<-EOHTML
<div class="attributes post">
- <div class="legend">Post</div>
+ <div class="legend"><span>Post</span></div>
<ol>
</ol>
</div>
<div class="attributes post">
- <div class="legend">Post</div>
+ <div class="legend"><span>Post</span></div>
<ol>
</ol>
</div>
View
@@ -12,7 +12,7 @@ class TestAttrtastic < TestCase
expected = html <<-EOHTML
<div class="attrtastic user">
<div class="attributes">
- <div class="legend">User</div>
+ <div class="legend"><span>User</span></div>
<ol>
<li class="attribute strong">
<span class="label">First name</span>
@@ -26,7 +26,7 @@ class TestAttrtastic < TestCase
</div>
<div class="attributes">
- <div class="legend">Contact</div>
+ <div class="legend"><span>Contact</span></div>
<ol>
<li class="attribute">
<span class="label">Email</span>
@@ -55,7 +55,7 @@ class TestAttrtastic < TestCase
expected = html <<-EOHTML
<div class="attrtastic user">
<div class="attributes">
- <div class="legend">User</div>
+ <div class="legend"><span>User</span></div>
<ol>
<li class="attribute">
<span class="label">First name</span>
@@ -69,7 +69,7 @@ class TestAttrtastic < TestCase
</div>
<div class="attributes">
- <div class="legend">Contact</div>
+ <div class="legend"><span>Contact</span></div>
<ol>
<li class="attribute">
<span class="label">Email</span>

0 comments on commit f0e9e6a

Please sign in to comment.