Skip to content

Commit

Permalink
Test component-partial-component path
Browse files Browse the repository at this point in the history
  • Loading branch information
mhw committed Jan 13, 2022
1 parent 001a8ec commit c40f91f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/sandbox/app/components/nested_content_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ncc{
}ncc
4 changes: 4 additions & 0 deletions test/sandbox/app/components/nested_content_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class NestedContentComponent < ViewComponent::Base
end
3 changes: 3 additions & 0 deletions test/sandbox/app/components/nested_partial_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npc{
<%= render partial: "nested_partial" %>
}npc
4 changes: 4 additions & 0 deletions test/sandbox/app/components/nested_partial_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class NestedPartialComponent < ViewComponent::Base
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
np{
<%= render NestedContentComponent.new %>
}np
6 changes: 6 additions & 0 deletions test/view_component/context_nesting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ def test_renders_tag_helper_with_capture_correctly
refute_selector("span + div#container", text: "</span>")
assert_selector("div#container > span", text: "Hello")
end

def test_renders_partial_with_component_correctly
render_inline(NestedPartialComponent.new)

assert_text("npc{ np{ ncc{ }ncc }np }npc", normalize_ws: true)
end
end

0 comments on commit c40f91f

Please sign in to comment.