This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,11 @@ def collect_other_params_as(name)
9898 define_method ( name ) do
9999 @_all_others ||= self . class . validator . undefined_props ( props )
100100 end
101+
102+ validator_in_lexial_scope = validator
103+ props_wrapper . define_method ( name ) do
104+ @_all_others ||= validator_in_lexial_scope . undefined_props ( props )
105+ end
101106 end
102107
103108 def define_state ( *states , &block )
Original file line number Diff line number Diff line change 22
33if opal?
44describe 'the param macro' do
5+ it 'defines collect_other_params_as method on params proxy' do
6+ stub_const 'Foo' , Class . new ( React ::Component ::Base )
7+ Foo . class_eval do
8+ collect_other_params_as :foo
9+
10+ def render
11+ div { params . foo [ :bar ] }
12+ end
13+ end
14+
15+ html = React . render_to_static_markup ( React . create_element ( Foo , { bar : 'biz' } ) )
16+ expect ( html ) . to eq ( '<div>biz</div>' )
17+ end
18+
19+ it 'still defines deprecated collect_other_params_as method' do
20+ stub_const 'Foo' , Class . new ( React ::Component ::Base )
21+ Foo . class_eval do
22+ collect_other_params_as :foo
23+
24+ def render
25+ div { foo [ :bar ] }
26+ end
27+ end
28+
29+ html = React . render_to_static_markup ( React . create_element ( Foo , { bar : 'biz' } ) )
30+ expect ( html ) . to eq ( '<div>biz</div>' )
31+ end
32+
533 it 'still defines deprecated param accessor method' do
634 stub_const 'Foo' , Class . new ( React ::Component ::Base )
735 Foo . class_eval do
You can’t perform that action at this time.
0 commit comments