Skip to content

Commit

Permalink
Failing test for relativize_paths filter.
Browse files Browse the repository at this point in the history
This fails only when the `<a>` and `<img>` are on the same line, and seems to only fail when the `href` attribute of the `<a>` is `"/"`.

--HG--
extra : transplant_source : %F8%EB%19%87%B55%12%D3%11f%1E%B4%1C%DF%D9X%DD%D3%FF%AC
  • Loading branch information
bobthecow committed Apr 11, 2012
1 parent e72048f commit 0937dbf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/filters/test_relativize_paths.rb
Expand Up @@ -101,6 +101,30 @@ def test_filter_html_multiple
assert_equal(expected_content, actual_content)
end

def test_filter_html_nested
# Create filter with mock item
filter = Nanoc::Filters::RelativizePaths.new

# Mock item
filter.instance_eval do
@item_rep = Nanoc::ItemRep.new(
Nanoc::Item.new(
'content',
{},
'/foo/bar/baz/'),
:blah)
@item_rep.path = '/foo/bar/baz/'
end

# Set content
raw_content = %[<a href="/"><img src="/bar.png" /></a>]
expected_content = %[<a href="../../../"><img src="../../../bar.png" /></a>]

# Test
actual_content = filter.run(raw_content, :type => :html)
assert_equal(expected_content, actual_content)
end

def test_filter_html_outside_tag
# Create filter with mock item
filter = Nanoc::Filters::RelativizePaths.new
Expand Down

0 comments on commit 0937dbf

Please sign in to comment.