Skip to content
Browse files

Failing test for relativize_paths filter.

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 `"/"`.
  • Loading branch information...
1 parent 00802cb commit 18b3c747d1681c61fe2aadd43f5de0f4f27d377f @bobthecow committed Apr 11, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/filters/test_relativize_paths.rb
View
24 test/filters/test_relativize_paths.rb
@@ -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

0 comments on commit 18b3c74

Please sign in to comment.
Something went wrong with that request. Please try again.