Sha256: 0df477ef054b8376bb8dd9e57647672503f1c3f8240e5ee19a73ca69b9a22fc5
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/test_helper' require 'webgen/tag/link' class TestTagLink < MiniTest::Unit::TestCase include Webgen::TestHelper def test_call setup_context setup_default_nodes(@website.tree) @context[:chain] = [@website.tree['/file.en.html']] @context[:config] = {'tag.link.attr' => {}} # invalid paths @context[:config]['tag.link.path'] = ':/asdf=-)' assert_raises(Webgen::RenderError) { Webgen::Tag::Link.call('link', '', @context) } # basic node resolving assert_tag_result('<a class="help" href="dir2/index.en.html" hreflang="en">index en</a>', 'dir2/index.html') @context[:config]['tag.link.attr'] = {'title' => 'other'} assert_tag_result('<a class="help" href="dir2/index.en.html" hreflang="en" title="other">index en</a>', 'dir2/index.html') @context[:config]['tag.link.attr'] = {} assert_tag_result('', 'german.html') # non-existing fragments assert_tag_result('', 'file.html#hallo') # directory paths assert_tag_result('<a href="dir/">dir</a>', 'dir') assert_tag_result('<a href="dir2/index.en.html" hreflang="en">routed</a>', 'dir2') end def assert_tag_result(result, path) @context[:config]['tag.link.path'] = path assert_equal(result, Webgen::Tag::Link.call('link', '', @context)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.0.0.beta1 | test/webgen/tag/test_link.rb |