Sha256: 258f9113eadc76e10f6df49765cb87aebfd79e937ede5e3ca00fd7f8d104da37

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

require 'minitest/autorun'

require '../../lib/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

8 entries across 8 versions & 1 rubygems

Version Path
livetext-0.9.22 test/unit/html.rb
livetext-0.9.21 test/unit/html.rb
livetext-0.9.20 test/unit/html.rb
livetext-0.9.19 test/unit/html.rb
livetext-0.9.17 test/unit/html.rb
livetext-0.9.15 test/unit/html.rb
livetext-0.9.14 test/unit/html.rb
livetext-0.9.13 test/unit/html.rb