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

Commit 4cb9b8a

Browse files
committed
Add test for #195
1 parent cbe679f commit 4cb9b8a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/react/native_library_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,28 @@ class NestedComponent < React::Component::Base
205205
end.to raise_error(/^Foo cannot import \'window\.Baz\'\: (?!does not appear to be a native react component)..*$/)
206206
end
207207

208+
it "allows passing native object as props" do
209+
%x{
210+
window.NativeComponent = React.createClass({
211+
displayName: "HelloMessage",
212+
render: function render() {
213+
return React.createElement("div", null, "Hello ", this.props.user.name);
214+
}
215+
})
216+
}
217+
stub_const 'Foo', Class.new(React::Component::Base)
218+
Foo.class_eval do
219+
imports "NativeComponent"
220+
end
221+
stub_const 'Wrapper', Class.new(React::Component::Base)
222+
Wrapper.class_eval do
223+
def render
224+
Foo(user: `{name: 'David'}`)
225+
end
226+
end
227+
expect(Wrapper).to render_static_html('<div>Hello David</div>')
228+
end
229+
208230
context "automatic importing" do
209231

210232
it "will automatically import a React.js component when referenced in another component" do

0 commit comments

Comments
 (0)