Sha256: 3c52a92a60123545dd4dd9ecd0cef6f06f1e906a06230c96ffb00cff9f14d711

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require File.dirname(__FILE__) + '/helper'

class HtmlTagTest < Test::Unit::TestCase
  include Liquor
  
  def test_html_table
    
    assert_template_result("<tr class=\"row1\">\n<td class=\"col1\"> 1 </td><td class=\"col2\"> 2 </td><td class=\"col3\"> 3 </td></tr>\n<tr class=\"row2\"><td class=\"col1\"> 4 </td><td class=\"col2\"> 5 </td><td class=\"col3\"> 6 </td></tr>\n",
                           '{% tablerow n in numbers cols:3%} {{n}} {% endtablerow %}', 
                           'numbers' => [1,2,3,4,5,6])

    assert_template_result("<tr class=\"row1\">\n</tr>\n",
                            '{% tablerow n in numbers cols:3%} {{n}} {% endtablerow %}', 
                            'numbers' => [])
  end
  
  def test_html_table_with_different_cols
    assert_template_result("<tr class=\"row1\">\n<td class=\"col1\"> 1 </td><td class=\"col2\"> 2 </td><td class=\"col3\"> 3 </td><td class=\"col4\"> 4 </td><td class=\"col5\"> 5 </td></tr>\n<tr class=\"row2\"><td class=\"col1\"> 6 </td></tr>\n",
                           '{% tablerow n in numbers cols:5%} {{n}} {% endtablerow %}', 
                           'numbers' => [1,2,3,4,5,6])
    
  end
  
  def test_html_col_counter
    assert_template_result("<tr class=\"row1\">\n<td class=\"col1\">1</td><td class=\"col2\">2</td></tr>\n<tr class=\"row2\"><td class=\"col1\">1</td><td class=\"col2\">2</td></tr>\n<tr class=\"row3\"><td class=\"col1\">1</td><td class=\"col2\">2</td></tr>\n",
                           '{% tablerow n in numbers cols:2%}{{tablerowloop.col}}{% endtablerow %}', 
                           'numbers' => [1,2,3,4,5,6])
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liquor-0.1.1 test/html_tag_test.rb
liquor-0.1.0 test/html_tag_test.rb