:add_attributes => { "a" => { "rel" => "nofollow noopener noreferrer" } },
:remove_contents => %w[script style],
:transformers => lambda do |env|
+ env[:node].remove_class
env[:node].add_class("table table-sm w-auto") if env[:node_name] == "table"
end
)
assert_html r do
assert_select "table[class='table table-sm w-auto']"
end
+
+ r = RichText.new("html", "<p class='btn btn-warning'>Click Me</p>")
+ assert_html r do
+ assert_select "p[class='btn btn-warning']", false
+ assert_select "p", /^Click Me$/
+ end
end
def test_html_to_text
assert_html r do
assert_select "table[class='table table-sm w-auto']"
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
end
def test_markdown_to_text