aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-08-16 16:49:05 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:04:07 +0200
commit97c5e6fa027d0ef9151172c193b1f61ee4c4c70a (patch)
tree4bc2fb6763031787f9455948c1a5e2e1003bb80d /actionview/test/template
parent9a3a59eaaefd175379963a3a6048bdb5b3950fb8 (diff)
downloadrails-97c5e6fa027d0ef9151172c193b1f61ee4c4c70a.tar.gz
rails-97c5e6fa027d0ef9151172c193b1f61ee4c4c70a.tar.bz2
rails-97c5e6fa027d0ef9151172c193b1f61ee4c4c70a.zip
Changed: remove_xpaths called with String returns String, while called with Loofah fragment returns Loofah fragment. Added tests for this.
Diffstat (limited to 'actionview/test/template')
-rw-r--r--actionview/test/template/sanitizers_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/actionview/test/template/sanitizers_test.rb b/actionview/test/template/sanitizers_test.rb
index 825a3a1b75..8d2934caed 100644
--- a/actionview/test/template/sanitizers_test.rb
+++ b/actionview/test/template/sanitizers_test.rb
@@ -37,6 +37,17 @@ class SanitizersTest < ActionController::TestCase
end
end
+ def test_sanitizer_remove_xpaths_called_with_string_returns_string
+ sanitizer = ActionView::Sanitizer.new
+ assert '<a></a>', sanitizer.remove_xpaths('<a></a>', [])
+ end
+
+ def test_sanitizer_remove_xpaths_called_with_fragment_returns_fragment
+ sanitizer = ActionView::Sanitizer.new
+ fragment = sanitizer.remove_xpaths(Loofah.fragment('<a></a>'), [])
+ assert_kind_of Loofah::HTML::DocumentFragment, fragment
+ end
+
def test_strip_tags_with_quote
sanitizer = ActionView::FullSanitizer.new
string = '<" <img src="trollface.gif" onload="alert(1)"> hi'