Sha256: e97ee7c98d9960498578e79bc14e606010a0a78510d9eeed16321956503c6f64

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

# -*- coding: utf-8 -*-
require File.join(File.dirname(__FILE__), "test_helper.rb")
require File.join(File.dirname(__FILE__), "../lib/grenweb/html_renderer.rb")

class TestGrenwebHTMLRendeler < Test::Unit::TestCase
  include Grenweb

  def setup
    @rendeler = HTMLRendeler.new('/')
  end

  def test_pagination_line
    assert_equal("<span class='pagination-link'><a href='?page=1'>test</a></span>\n", @rendeler.pagination_link(1, "test"))
  end
  
  def test_search_summary
    assert_equal(@rendeler.search_summary(10, 500, 10..20, 0.00893),
                 <<-EOS)
  <div class='search-summary'>
    <span class="keyword">10</span>の検索結果:
    <span class="total-entries">500</span>件中
    <span class="display-range">10 - 20</span>件(0.00893秒)
  </div>
EOS
  end

  def test_match_strong
    assert_equal(@rendeler.match_strong("This is line.", [nil, nil]), "This is line.")
  end

  def test_search_box
    assert_equal(@rendeler.search_box('test must'), <<-EOF)
<form method="post" action="/::search">
  <p>
    <input name="query" type="text" size="60" value="test must" />
    <input type="submit" value="検索" />
  </p>
</form>
EOF
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
codestock-0.1.0 test/test_grenweb_html_renderer.rb
gren-0.3.2 test/test_grenweb_html_renderer.rb
gren-0.3.1 test/test_grenweb_html_renderer.rb