Sha256: c8d6c76b197c76572a58e1585c8cba28514a2bffad3fec96c899d03d432966da

Contents?: true

Size: 1.38 KB

Versions: 12

Compression:

Stored size: 1.38 KB

Contents

# -*- encoding: utf-8 -*-

require 'test/unit'
require 'helper'
require 'webgen/tree'
require 'webgen/contentprocessor'
require 'webgen/tag'

class TestTagSitemap < Test::Unit::TestCase

  include Test::WebsiteHelper

  def setup
    super
    @obj = Webgen::Tag::Sitemap.new
  end

  def call(context, honor_in_menu, any_lang, used_kinds)
    @obj.set_params({'common.sitemap.honor_in_menu' => honor_in_menu,
                      'common.sitemap.any_lang' => any_lang,
                      'common.sitemap.used_kinds' => used_kinds})
    result = @obj.call('sitemap', '', context)
    @obj.set_params({})
    result
  end

  def test_call
    nodes = create_sitemap_nodes
    context = Webgen::Context.new(:chain => [nodes[:file11_en]])

    assert_equal("<ul><li><a href=\"./\"></a>" +
                 "<ul><li><span></span>"+
                 "<ul><li><a href=\"#f1\"></a></li></ul></li></ul></li>" +
                 "<li><a href=\"../dir2/\"></a>" +
                 "<ul><li><a href=\"../dir2/file21.en.html\"></a></li></ul></li>"+
                 "<li><a href=\"../index.en.html\"></a></li>" +
                 "<li><a href=\"../dir3/index.en.html\"></a></li></ul>",
                 call(context, false, false, []))
    assert_equal("",
                 call(context, false, false, ['noone']))
  end

  def test_tag_config_base
    assert_equal('common.sitemap', @obj.send(:tag_config_base))
  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.8.20090507 test/test_tag_sitemap.rb
gettalong-webgen-0.5.9.20090620 test/test_tag_sitemap.rb
gettalong-webgen-0.5.9.20090626 test/test_tag_sitemap.rb
webgen-0.5.17 test/test_tag_sitemap.rb
webgen-0.5.15 test/test_tag_sitemap.rb
webgen-0.5.14 test/test_tag_sitemap.rb
webgen-0.5.13 test/test_tag_sitemap.rb
webgen-0.5.12 test/test_tag_sitemap.rb
webgen-0.5.11 test/test_tag_sitemap.rb
webgen-0.5.10 test/test_tag_sitemap.rb
webgen-0.5.9 test/test_tag_sitemap.rb
webgen-0.5.8 test/test_tag_sitemap.rb