2016-07-07 01:46:47 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'pretty_text'
|
|
|
|
|
|
|
|
describe PrettyText do
|
|
|
|
|
|
|
|
it "supports details tag" do
|
2017-07-19 02:44:49 +08:00
|
|
|
cooked_html = <<~HTML
|
|
|
|
<details>
|
|
|
|
<summary>
|
|
|
|
foo</summary>
|
|
|
|
<p>bar</p>
|
|
|
|
</details>
|
|
|
|
HTML
|
2018-02-08 07:01:11 +08:00
|
|
|
|
|
|
|
expect(cooked_html).to match_html(cooked_html)
|
|
|
|
expect(PrettyText.cook("[details=foo]\nbar\n[/details]")).to match_html(cooked_html)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "deletes elided content" do
|
|
|
|
cooked_html = PrettyText.cook("Hello World\n\n<details class='elided'>42</details>")
|
|
|
|
mail_html = PrettyText.cook("Hello World")
|
|
|
|
|
|
|
|
expect(PrettyText.format_for_email(cooked_html)).to match_html(mail_html)
|
2016-07-07 01:46:47 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|