Sha256: 83e263ba8ac703a156f635694ceb37ae8069179554f501dc5b379349bae094a8
Contents?: true
Size: 1.03 KB
Versions: 48
Compression:
Stored size: 1.03 KB
Contents
require File.expand_path('../helper', __FILE__) class HtmlHelpersTest < Test::Unit::TestCase include Sinatra::HtmlHelpers describe "tag" do test "the basic no attr case" do assert_equal '<div>Foobar</div>', tag('div', 'Foobar') end test "one attr case" do assert_equal '<div class="baz">Foobar</div>', tag('div', 'Foobar', :class => 'baz') end test "many attrs case" do assert_equal '<div class="baz bar" style="display:none">Foobar</div>', tag('div', 'Foobar', :class => 'baz bar', :style => 'display:none') end test "funky attrs case" do assert_equal '<div class="baz 'bar'" ' + 'style="display:"none"">Foobar</div>', tag('div', 'Foobar', :class => "baz 'bar'", :style => 'display:"none"') end end test "h" do assert_equal "<Foo>", h("<Foo>") assert_match /^<Foo bar=&#.*?;baz&#.*?;>$/, h("<Foo bar='baz'>") assert_equal "<Foo bar="baz">", h("<Foo bar=\"baz\">") end end
Version data entries
48 entries across 48 versions & 2 rubygems