Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/react/rails/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def assert_react_component(name)
assert_select "div[data-react-class=?]", name do |dom|
if block_given?
props = JSON.parse(dom.attr("data-react-props"))
props.deep_transform_keys! { |key| key.to_s.underscore }
props.deep_symbolize_keys!

yield(props)
Expand Down
2 changes: 1 addition & 1 deletion test/dummy_sprockets/app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</ul>

<div id='component-parent'>
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<%= react_component 'GreetingMessage', { name: @name, lastName: "Last #{@name}", info: { name: @name, lastName: "Last #{@name}" } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<ul>
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion test/dummy_webpacker1/app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</ul>

<div id='component-parent'>
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<%= react_component 'GreetingMessage', { name: @name, lastName: "Last #{@name}", info: { name: @name, lastName: "Last #{@name}" } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<ul>
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion test/dummy_webpacker2/app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</ul>

<div id='component-parent'>
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<%= react_component 'GreetingMessage', { name: @name, lastName: "Last #{@name}", info: { name: @name, lastName: "Last #{@name}" } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<ul>
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion test/dummy_webpacker3/app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</ul>

<div id='component-parent'>
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
<%= react_component 'GreetingMessage', { name: @name, lastName: "Last #{@name}", info: { name: @name, lastName: "Last #{@name}" } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
Copy link
Member

@BookOfGreg BookOfGreg Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the same in the other dummy applications?
That should make the tests pass.

test/dummy_sprockets/app/views/pages/show.html.erb
test/dummy_webpacker1/app/views/pages/show.html.erb
test/dummy_webpacker2/app/views/pages/show.html.erb

Copy link
Member

@BookOfGreg BookOfGreg Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ul>
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
</ul>
Expand Down
3 changes: 2 additions & 1 deletion test/react/rails/test_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class TestHelperTest < ActionDispatch::IntegrationTest
assert_react_component "GreetingMessage"
assert_react_component "GreetingMessage" do |props|
assert_equal "Bob", props[:name]
assert_equal "Last Bob", props[:last_name]
assert_equal "Last Bob", props[:lastName]
assert_equal "Bob", props[:info][:name]
assert_equal "Last Bob", props[:info][:lastName]

assert_select "[id=?]", "component"
assert_select "[class=?]", "greeting-message"
Expand Down