Sha256: 2970007ed7e4d7b628b8809029f94c75bd55fd244c81d3bcbfe8d1891f46159c

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'minitest/autorun'

require 'livetext'

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

  # 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 } }
    dump  # puts @body
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
livetext-0.9.35 test/unit/html.rb
livetext-0.9.33 test/unit/html.rb
livetext-0.9.32 test/unit/html.rb
livetext-0.9.31 test/unit/html.rb
livetext-0.9.30 test/unit/html.rb
livetext-0.9.27 test/unit/html.rb
livetext-0.9.26 test/unit/html.rb
livetext-0.9.25 test/unit/html.rb