Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass options to the text method. #35

Merged
merged 1 commit into from
Mar 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rails/html/sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def sanitize(html, options = {})

Loofah.fragment(html).tap do |fragment|
remove_xpaths(fragment, XPATHS_TO_REMOVE)
end.text
end.text(options)
end
end

Expand Down
5 changes: 5 additions & 0 deletions test/sanitizer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def test_strip_tags_with_frozen_string
assert_equal "Frozen string with no tags", full_sanitize("Frozen string with no tags".freeze)
end

def test_full_sanitize_allows_turning_off_encoding_special_chars
assert_equal '&', full_sanitize('&')
assert_equal '&', full_sanitize('&', encode_special_chars: false)
end

def test_strip_links_with_tags_in_tags
expected = "a href='hello'&gt;all <b>day</b> long/a&gt;"
input = "<<a>a href='hello'>all <b>day</b> long<</A>/a>"
Expand Down