Sha256: 120e20145c4fd56a656991db96318fbcca3af49b7f17347a4dccea654f4100f6
Contents?: true
Size: 1.73 KB
Versions: 3
Compression:
Stored size: 1.73 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper')) class TestHtml < Test::Unit::TestCase context "html fragment" do context "#to_s" do should "not include head tags (like style)" do html = Loofah.fragment "<style>foo</style><div>bar</div>" assert_equal "<div>bar</div>", html.to_s end end context "#text" do should "not include head tags (like style)" do html = Loofah.fragment "<style>foo</style><div>bar</div>" assert_equal "bar", html.text end end context "#to_text" do should "add newlines before and after block elements" do html = Loofah.fragment "<div>tweedle<h1>beetle</h1>bottle<span>puddle</span>paddle<div>battle</div>muddle</div>" assert_equal "\ntweedle\nbeetle\nbottlepuddlepaddle\nbattle\nmuddle\n", html.to_text end should "remove extraneous whitespace" do html = Loofah.fragment "<div>tweedle\n\n\t\n\s\nbeetle</div>" assert_equal "\ntweedle\n\nbeetle\n", html.to_text end end end context "html document" do should "not include head tags (like style)" do html = Loofah.document "<style>foo</style><div>bar</div>" assert_equal "bar", html.text end context "#to_text" do should "add newlines before and after block elements" do html = Loofah.document "<div>tweedle<h1>beetle</h1>bottle<span>puddle</span>paddle<div>battle</div>muddle</div>" assert_equal "\ntweedle\nbeetle\nbottlepuddlepaddle\nbattle\nmuddle\n", html.to_text end should "remove extraneous whitespace" do html = Loofah.document "<div>tweedle\n\n\t\n\s\nbeetle</div>" assert_equal "\ntweedle\n\nbeetle\n", html.to_text end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loofah-1.0.0 | test/integration/test_html.rb |
loofah-1.0.0.beta.1 | test/integration/test_html.rb |
loofah-0.4.7 | test/integration/test_html.rb |