This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 5353 before do
5454 stub_const 'Foo' , Class . new
5555 Foo . class_eval do
56+ def initialize ( native )
57+ @native = native
58+ end
59+
5660 def render
5761 React . create_element ( "div" ) { "lorem" }
5862 end
63+
64+ def props
65+ Hash . new ( `#@native .props` )
66+ end
5967 end
6068 end
6169
6270 it "should render element with only one children correctly" do
6371 element = React . create_element ( Foo ) { React . create_element ( 'span' ) }
64- instance = renderElementToDocument ( element )
65- expect ( instance . props . children ) . not_to be_a ( Array )
66- expect ( instance . props . children . type ) . to eq ( "span" )
72+ instance = React :: Test :: Utils . render_into_document ( element )
73+ expect ( instance . props [ : children] ) . not_to be_a ( Array )
74+ expect ( instance . props [ : children] [ : type] ) . to eq ( "span" )
6775 end
6876
6977 it "should render element with more than one children correctly" do
7078 element = React . create_element ( Foo ) { [ React . create_element ( 'span' ) , React . create_element ( 'span' ) ] }
71- instance = renderElementToDocument ( element )
72- expect ( instance . props . children ) . to be_a ( Array )
73- expect ( instance . props . children . length ) . to eq ( 2 )
79+ instance = React :: Test :: Utils . render_into_document ( element )
80+ expect ( instance . props [ : children] ) . to be_a ( Array )
81+ expect ( instance . props [ : children] . length ) . to eq ( 2 )
7482 end
7583
7684 it "should create a valid element provided class defined `render`" do
You can’t perform that action at this time.
0 commit comments