Sha256: f3d8b5afb9e2b5b49dcfaea2e74856cb97a6d0fc2f4790f5747085ddf05de44a
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "HtmlGen" do it "should be able to generate html" do html = Html_gen::Element.new(:td, :classes => [:test]).html(:pretty => false) raise "Expected valid HTML." if html != "<td class=\"test\" />" html = Html_gen::Element.new(:td, :attr => {:colspan => 2}).html(:pretty => false) raise "Expected valid HTML." if html != "<td colspan=\"2\" />" html = Html_gen::Element.new(:td, :css => {:width => "80px"}).html(:pretty => false) raise "Expected valid HTML: '#{html}'." if html != "<td style=\"width: 80px;\" />" a = Html_gen::Element.new(:a) b = a.add_ele(:b) b.str = "Test" html = a.html(:pretty => false) raise "Expected something else." if html != "<a><b>Test</b></a>" html = Html_gen::Element.new(:b, :str => "<b>Test</b>").html(:pretty => false) raise "Expected escape HTML: '#{html}'." if html != "<b><b>Test</b></b>" html = Html_gen::Element.new(:b, :str_html => "<b>Test</b>").html(:pretty => false) raise "Expected escape HTML: '#{html}'." if html != "<b><b>Test</b></b>" div_ele = Html_gen::Element.new(:div) div_ele.add_ele(:br) div_ele.add_str("This is a test") html = div_ele.html(:pretty => false) raise "Expected HTML: '#{html}'." if html != "<div><br />This is a test</div>" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html_gen-0.0.5 | spec/html_gen_spec.rb |
html_gen-0.0.4 | spec/html_gen_spec.rb |