Sha256: bc2a00340d3daa7d6c426ea381ae3998cd0429468e25251975f4e55e7de7baff

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'minitest/autorun'

require 'livetext'

class TestingLivetext < MiniTest::Test
  include Livetext::Standard
  include Livetext::UserAPI

  # Some of these methods being tested "really" belong elsewhere?
  # Same is probably true of the methods that are testing them.

  def test_wrapped
    cdata = "nothing much"
    assert_equal wrapped(cdata, :b),     "<b>#{cdata}</b>"
    assert_equal wrapped(cdata, :b, :i), "<b><i>#{cdata}</i></b>"

    assert_equal wrapped(cdata, :table, :tr, :td),
                          "<table><tr><td>#{cdata}</td></tr></table>"
  end

  def test_wrapped_bang
    cdata = "nothing much"
    assert_equal wrapped!(cdata, :td, valign: :top), 
                     "<td valign='top'>#{cdata}</td>"
    assert_equal wrapped!(cdata, :img, src: "foo.jpg"),
                    "<img src='foo.jpg'>#{cdata}</img>"
    assert_equal wrapped!(cdata, :a, style: 'text-decoration: none', 
                     href: 'foo.com'),
                     "<a style='text-decoration: none' href='foo.com'>#{cdata}</a>"
  end

  def xtest_wrap
    # bogus!
    wrap(:ul) { 2.times {|i| _out i } }
    puts @body
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
livetext-0.9.24 test/unit/html.rb
livetext-0.9.23 test/unit/html.rb