Sha256: 02b181142643e1302dc5ce8b1b1eeab508849977204913fb58b7e2a52f9527f6

Contents?: true

Size: 631 Bytes

Versions: 12

Compression:

Stored size: 631 Bytes

Contents

require 'helper'
require 'turnip_formatter/renderer/html/data_table'
require 'turnip/table'

module TurnipFormatter::Renderer::Html
  class TestDataTable < Test::Unit::TestCase
    def test_render
      renderer = DataTable.new(
        table(
          [
            ['name', 'hp'],
            ['slime', '10'],
            ['daemon', '300']
          ]
        )
      )

      document = html_parse(renderer.render).at_xpath('table')

      assert_equal(3, document.xpath('./tr').size)
      assert_equal(6, document.xpath('.//td').size)
    end

    private

    def table(rows)
      Turnip::Table.new(rows)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
turnip_formatter-0.8.0 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.7.2 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.7.1 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.7.0 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.1 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.7 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.6 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.5 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.4 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.3 test/turnip_formatter/renderer/html/test_data_table.rb
turnip_formatter-0.6.0.pre.beta.2 test/turnip_formatter/renderer/html/test_data_table.rb