File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 7
7
require 'patches/mapper'
8
8
9
9
ActionController ::Renderers . add :inertia do |component , options |
10
+ if component . is_a? ( Hash ) && options [ :props ] . nil?
11
+ options [ :props ] = component
12
+ component = true
13
+ end
14
+
10
15
InertiaRails ::Renderer . new (
11
16
component ,
12
17
self ,
Original file line number Diff line number Diff line change @@ -26,4 +26,8 @@ def provided_props_test
26
26
def default_component_test
27
27
render inertia : true
28
28
end
29
+
30
+ def default_component_with_params_test
31
+ render inertia : { my : 'props' }
32
+ end
29
33
end
Original file line number Diff line number Diff line change 43
43
get 'default_render_test' => 'inertia_rails_mimic#default_render_test'
44
44
get 'transformed_default_render_test' => 'transformed_inertia_rails_mimic#render_test'
45
45
get 'default_component_test' => 'inertia_rails_mimic#default_component_test'
46
+ get 'default_component_with_params_test' => 'inertia_rails_mimic#default_component_with_params_test'
46
47
get 'provided_props_test' => 'inertia_rails_mimic#provided_props_test'
47
48
48
49
post 'redirect_to_share_test' => 'inertia_test#redirect_to_share_test'
Original file line number Diff line number Diff line change 24
24
25
25
expect_inertia . to render_component ( 'inertia_rails_mimic/default_component_test' )
26
26
end
27
+
28
+ it 'has the correct derived component with props' do
29
+ get default_component_with_params_test_path
30
+
31
+ expect_inertia . to render_component ( 'inertia_rails_mimic/default_component_with_params_test' )
32
+ . and have_exact_props ( { my : 'props' } )
33
+ end
27
34
end
28
35
29
36
context 'no render is done at all and default_render is enabled' do
You can’t perform that action at this time.
0 commit comments