Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/3152'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Mar 24, 2021
2 parents 580b7bf + bb2afc3 commit cd99ff2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/initializers/sanitize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:remove_contents => %w[script style],
:transformers => lambda do |env|
env[:node].remove_class
env[:node].kwattr_remove("style", nil)
env[:node].add_class("table table-sm w-auto") if env[:node_name] == "table"
end
)
13 changes: 12 additions & 1 deletion test/lib/rich_text_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def test_html_to_html
assert_select "p[class='btn btn-warning']", false
assert_select "p", /^Click Me$/
end

r = RichText.new("html", "<p style='color:red'>Danger</p>")
assert_html r do
assert_select "p[style='color:red']", false
assert_select "p", /^Danger$/
end
end

def test_html_to_text
Expand Down Expand Up @@ -163,11 +169,16 @@ def test_markdown_to_html
end

r = RichText.new("markdown", "Click Me\n{:.btn.btn-warning}")
# raise r.to_html
assert_html r do
assert_select "p[class='btn btn-warning']", false
assert_select "p", /^Click Me$/
end

r = RichText.new("markdown", "<p style='color:red'>Danger</p>")
assert_html r do
assert_select "p[style='color:red']", false
assert_select "p", /^Danger$/
end
end

def test_markdown_to_text
Expand Down

0 comments on commit cd99ff2

Please sign in to comment.