Skip to content

Commit e030634

Browse files
authored
Merge pull request #974 from reactjs/fix/assert-react-component-with-multiple-case
Fix/assert react component with multiple case
2 parents 4e7d604 + e0b89b5 commit e030634

File tree

7 files changed

+16
-4
lines changed

7 files changed

+16
-4
lines changed

lib/react/server_rendering/webpacker_manifest_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def file_path path
7979
end
8080
elsif MAJOR >= 3
8181
def file_path path
82-
::Rails.root.join('public', manifest.lookup(path)[1..-1])
82+
::Rails.root.join('public', manifest.lookup!(path)[1..-1])
8383
end
8484
else # 1.0 and 1.1 support
8585
def file_path path

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
},
1313
"devDependencies": {
1414
"webpack": "^2.3.3"
15+
},
16+
"dependencies": {
17+
"react_ujs": "^2.4.4"
1518
}
1619
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</ul>
55

66
<div id='component-parent'>
7-
<%= react_component 'GreetingMessage', { name: @name }, { id: 'component', prerender: @prerender } %>
7+
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
88
<ul>
99
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
1010
</ul>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</ul>
55

66
<div id='component-parent'>
7-
<%= react_component 'GreetingMessage', { name: @name }, { id: 'component', prerender: @prerender } %>
7+
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
88
<ul>
99
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
1010
</ul>

test/dummy_webpacker3/app/views/pages/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</ul>
55

66
<div id='component-parent'>
7-
<%= react_component 'GreetingMessage', { name: @name }, { id: 'component', prerender: @prerender } %>
7+
<%= react_component 'GreetingMessage', { name: @name, last_name: "Last #{@name}", info: { name: @name } }, { id: 'component', class: "greeting-message", prerender: @prerender } %>
88
<ul>
99
<%= react_component 'Todo', { todo: 'Another Component' }, { id: 'todo', prerender: @prerender } %>
1010
</ul>

test/react/rails/test_helper_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
require 'test_helper'
22

33
class TestHelperTest < ActionDispatch::IntegrationTest
4+
setup do
5+
WebpackerHelpers.compile_if_missing
6+
end
7+
48
test 'assert_react_component' do
59
get "/pages/1"
610
assert_equal 200, response.status

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,11 @@ rc@^1.1.7:
13141314
minimist "^1.2.0"
13151315
strip-json-comments "~2.0.1"
13161316

1317+
react_ujs@^2.4.4:
1318+
version "2.4.4"
1319+
resolved "https://registry.yarnpkg.com/react_ujs/-/react_ujs-2.4.4.tgz#49bac535d24024a96b0a35d7514d18188aea42bc"
1320+
integrity sha512-RON6mgV+I3s6KkmvxTQi+WGuoLbhZ+TzRat06EE/RHFvzU+Na1Eom6XnesQeOP7WCrTZGOdcZEPP0P7QrJrHfg==
1321+
13171322
read-pkg-up@^1.0.1:
13181323
version "1.0.1"
13191324
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"

0 commit comments

Comments
 (0)