mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
make sure rendering the content attachment actually works
This commit is contained in:
parent
9918ce4a78
commit
5f342cfdbe
2 changed files with 11 additions and 1 deletions
|
@ -20,7 +20,7 @@ module ActionText
|
|||
end
|
||||
|
||||
def to_html
|
||||
@to_html ||= content_instance.render
|
||||
@to_html ||= content_instance.render(content_instance)
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -69,6 +69,16 @@ class ActionText::AttachmentTest < ActiveSupport::TestCase
|
|||
assert_equal "abc", trix_attachment.attributes["content"]
|
||||
end
|
||||
|
||||
test "renders content attachment" do
|
||||
html = '<action-text-attachment content-type="text/html" content="<p>abc</p>"></action-text-attachment>'
|
||||
attachment = attachment_from_html(html)
|
||||
attachable = attachment.attachable
|
||||
|
||||
ActionText::Content.with_renderer MessagesController.renderer do
|
||||
assert_equal "<p>abc</p>", attachable.to_html.strip
|
||||
end
|
||||
end
|
||||
|
||||
test "defaults trix partial to model partial" do
|
||||
attachable = Page.create! title: "Homepage"
|
||||
assert_equal "pages/page", attachable.to_trix_content_attachment_partial_path
|
||||
|
|
Loading…
Reference in a new issue