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

Fix issue when passing single Native Object as param to a component #195

Merged
merged 1 commit into from
Jan 22, 2017

Conversation

noma4i
Copy link
Contributor

@noma4i noma4i commented Dec 4, 2016

Followup from gitter chat.
Patch is a result of the debugging react-bootstrap-table to work as 3rd party component in a rails app.

kudos to @catmando

@catmando
Copy link
Contributor

catmando commented Dec 4, 2016

Here is a test case (approximately)

  it "can pass a native hash to a component" do
    %x{
      window.NativeLibrary = {
        NativeComponent: React.createClass({
          displayName: "HelloMessage",
          render: function render() {
            return React.createElement("div", null, "Hello ", this.props.hash['key']);
          }
        })
      }
    }
    stub_const 'Bar', Class.new(React::NativeLibrary)
    Bar.class_eval do
      imports "NativeLibrary"
    end
    stub_const 'Foo', Class.new(React::Component::Base)
    Foo.class_eval do
      render Bar, p1: `{key: "fred"}`
    end
    expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span>hello fred</span>')
  end

should go in the DSL spec

Copy link
Member

@zetachang zetachang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and as @catmando suggested, it would be nice if you could add a test case for this.

@noma4i
Copy link
Contributor Author

noma4i commented Dec 4, 2016

Will do just a bit later. Leave this PR open for now.

@zetachang
Copy link
Member

@noma4i would you mind enabling Allow edits from maintainers for this PR.

https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/

@catmando
Copy link
Contributor

@zetachang can you finish this up? Have not heard from @Noma41 for a while

@zetachang
Copy link
Member

Sure.

@zetachang zetachang merged commit d5f85a1 into ruby-hyperloop:master Jan 22, 2017
zetachang added a commit that referenced this pull request Jan 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants