spec/lib/change_spec.rb in crazy_harry-0.1.0 vs spec/lib/change_spec.rb in crazy_harry-0.1.2
- old
+ new
@@ -27,9 +27,14 @@
it "should not unwrap paragraphs indiscriminately" do
harry.fragment('<p><b>Header</b><br />Content</p>').change!(from: 'b', to: 'h3').to_s.should ==
'<p><h3>Header</h3>Content</p>'
end
+ it "should wrap orphaned list items" do
+ harry.fragment('<p><li>orphan</li><ul><li>item</li></p>').change!(from: 'b', to: 'h3').to_s.should ==
+ '<ul><li>orphan</li></ul><ul><li>item</li></ul>'
+ end
+
context "chaining" do
it "should be able to chain calls" do
harry.fragment( '<b>Location:</b><br />Saigon' ).change!( from: 'b', to: 'h3').change!( from: 'br', to: 'p' ).to_s.should ==
'<h3>Location:</h3><p>Saigon</p>'