-
Notifications
You must be signed in to change notification settings - Fork 456
Slots return stripped HTML #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -359,6 +359,11 @@ class IntegrationTest < ActionDispatch::IntegrationTest | |||||
assert_select(".item.normal", count: 2) | ||||||
|
||||||
assert_select(".footer.text-blue h3", text: "This is the footer") | ||||||
|
||||||
title_node = Nokogiri::HTML.fragment(response.body).css(".title").to_html | ||||||
expected_title_html = "<div class=\"title\">\n <p>This is my title!</p>\n </div>" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would we have to do to get this to succeed?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jonrohan we'd have to strip the rendered output for the component itself. It's certainly doable 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The browser wouldn't treat these differently, but they are 10 bytes in size difference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recently made some changes to |
||||||
|
||||||
assert_equal(title_node, expected_title_html) | ||||||
end | ||||||
|
||||||
if Rails.version.to_f >= 6.1 | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will
.capture
always returnhtml_safe?
content?I'm curious if it'd make sense to check if the captured content is
html_safe?
and only applyhtml_safe
if it was already marked as HTML safe.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BlakeWilliams
capture
returns anActiveSupport::SafeBuffer
, so I think we're fine to assume that it is safe.