Skip to content

Commit

Permalink
Docs: Add html_safe example to testing->slots section (ViewComponen…
Browse files Browse the repository at this point in the history
…t#1815)

* Add `html_safe` example to testing doc slots section

Ran into an issue where a tested component was rendering the passed slot as plain text.  Thought a doc example with `html_safe` might help others with testing.

* Update CHANGELOG.md
  • Loading branch information
tgaff authored and claudiob committed Dec 22, 2023
1 parent 67752bb commit 047c89d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ nav_order: 5

*Cameron Dutro*

* Minor testing documentation improvement.

*Travis Gaff*

## 3.5.0

* Add Skroutz to users list.
Expand Down
1 change: 1 addition & 0 deletions docs/guide/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_render_component
component = ListComponent.new(title: "Fruits").tap do |c|
c.with_item { "Apple" }
c.with_item { "Orange" }
c.with_extra { "<div><span>rendered html</span></div>".html_safe }
end

render_inline(component)
Expand Down

0 comments on commit 047c89d

Please sign in to comment.