mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: Bundle discourse-spoiler-alert plugin into core (#24030)
* FEATURE: Bundle discourse-spoiler-alert plugin into core
Formerly https://github.com/discourse/discourse-spoiler-alert
* DEV: Switch to new addComposerToolbarPopupMenuOption plugin API
`api.addToolbarPopupMenuOptionsCallback` has been deprecated in 913fd3a7b392b492f6344102577960a6eada00ce
This commit was just added to the plugin, so adding it here.
49f86ba72e
This commit is contained in:
34
plugins/spoiler-alert/spec/pretty_text_spec.rb
Normal file
34
plugins/spoiler-alert/spec/pretty_text_spec.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
describe PrettyText do
|
||||
let(:post) { Fabricate(:post) }
|
||||
|
||||
def n(html)
|
||||
html.strip
|
||||
end
|
||||
|
||||
it "can spoil blocks" do
|
||||
md = PrettyText.cook("[spoiler]\nmy tests fail\n[/spoiler]")
|
||||
html = "<div class=\"spoiler\">\n<p>my tests fail</p>\n</div>"
|
||||
|
||||
expect(md).to eq(html)
|
||||
end
|
||||
|
||||
it "can spoil inline" do
|
||||
md = PrettyText.cook("I like watching [spoiler]my tests fail[/spoiler]")
|
||||
html = '<p>I like watching <span class="spoiler">my tests fail</span></p>'
|
||||
|
||||
expect(md).to eq(html)
|
||||
end
|
||||
|
||||
it "can replace spoilers in emails" do
|
||||
md = PrettyText.cook("I like watching [spoiler]my tests fail[/spoiler]")
|
||||
md = PrettyText.format_for_email(md, post)
|
||||
html =
|
||||
"<p>I like watching <span class=\"spoiler\"><a href=\"#{post.full_url}\">spoiler</a></span></p>"
|
||||
|
||||
expect(md).to eq(html)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user