Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 088533d

Browse files
committed
Fix undefined method block' for <MyComponent>`
1 parent 4465e12 commit 088533d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/react/component/props_wrapper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class PropsWrapper
44
attr_reader :props
55

66
def self.define_param(name, param_type, owner)
7-
owner.define_method("#{name}") do
7+
owner.define_method("#{name}") do |*args, &block|
88
deprecated_params_method("#{name}", *args, &block)
99
end
1010
if param_type == Observable

spec/react/param_declaration_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
if opal?
44
describe 'the param macro' do
5+
it 'still defines deprecated param accessor method' do
6+
stub_const 'Foo', Class.new(React::Component::Base)
7+
Foo.class_eval do
8+
param :foo
9+
10+
def render
11+
div { foo }
12+
end
13+
end
14+
15+
html = React.render_to_static_markup(React.create_element(Foo, {foo: :bar}))
16+
expect(html).to eq('<div>bar</div>')
17+
end
18+
519
it "can create and access a required param" do
620
stub_const 'Foo', Class.new(React::Component::Base)
721
Foo.class_eval do

0 commit comments

Comments
 (0)