Permalink
Browse files

This reverts 71036bf

  • Loading branch information...
1 parent 7432a15 commit 1b6cb070ebc6181078ef68b8b5cf782000d3f8f8 @jeremyruppel jeremyruppel committed May 26, 2011
@@ -85,10 +85,7 @@ def indent(open_tag, child_content, close_tag)
html = ""
- if no_child?
- # self-closing tag
- html << spaces << open_tag.sub( />$/, '/>' )
- elsif child_is_text?
+ if no_child? || child_is_text?
# one line
html << spaces << open_tag << child_content << close_tag
else
@@ -216,7 +216,7 @@
let(:collection){ "hello World" + h1}
it "should return a string" do
- collection.strip.chomp.should == "hello World<h1/>"
+ collection.strip.chomp.should == "hello World<h1></h1>"
end
end
end
@@ -15,7 +15,7 @@
it "should render the attributes to html" do
tag.to_html.should == <<-HTML
-<tag id="my_id"/>
+<tag id="my_id"></tag>
HTML
end
@@ -48,13 +48,13 @@
it "should html safe the attribute values" do
tag.set_attribute(:class, "\">bad things!")
tag.to_html.should == <<-HTML
-<tag class="&quot;&gt;bad things!"/>
+<tag class="&quot;&gt;bad things!"></tag>
HTML
end
it "should should escape the attribute names" do
tag.set_attribute(">bad", "things")
tag.to_html.should == <<-HTML
-<tag &gt;bad="things"/>
+<tag &gt;bad="things"></tag>
HTML
end
end
@@ -69,9 +69,9 @@
end
content.to_html.should == <<-HTML
<div>
- <ul/>
+ <ul></ul>
<li>
- <li/>
+ <li></li>
</li>
</div>
HTML
@@ -86,7 +86,7 @@
content.to_html.should == <<-HTML
<div>
<ul>
- <li/>
+ <li></li>
</ul>
</div>
HTML
@@ -100,7 +100,7 @@
<div>
<span>
<ul>
- <li/>
+ <li></li>
</ul>
</span>
</div>
@@ -117,7 +117,7 @@
content.to_html.should == <<-HTML
<div id="my-tag">
<ul>
- <li/>
+ <li></li>
</ul>
</div>
HTML
@@ -147,18 +147,18 @@
end.children.first.should be_instance_of(Arbre::HTML::TextNode)
end
end
-
+
describe "self-closing nodes" do
- it "should close tags that do not have any child nodes" do
- tag = li
+ it "should not self-close script tags" do
+ tag = script :type => 'text/javascript'
tag.to_html.should == <<-HTML
-<li/>
+<script type="text/javascript"></script>
HTML
end
- it "should close tags that have attributes but no child nodes" do
- tag = meta :"http-equiv" => "Content-type", :content => "text/html; charset=utf-8"
+ it "should self-close meta tags" do
+ tag = meta :content => "text/html; charset=utf-8"
tag.to_html.should == <<-HTML
-<meta http-equiv="Content-type" content="text/html; charset=utf-8\"/>
+<meta content="text/html; charset=utf-8\"/>
HTML
end
end

0 comments on commit 1b6cb07

Please sign in to comment.