@@ -13,8 +13,7 @@ def render
1313 end
1414 end
1515
16- html = React . render_to_static_markup ( React . create_element ( Foo , { bar : 'biz' } ) )
17- expect ( html ) . to eq ( '<div>biz</div>' )
16+ expect ( render_to_html ( Foo , bar : 'biz' ) ) . to eq ( '<div>biz</div>' )
1817 end
1918
2019 it "can create and access a required param" do
@@ -27,7 +26,7 @@ def render
2726 end
2827 end
2928
30- expect ( React . render_to_static_markup ( React . create_element ( Foo , { foo : :bar } ) ) ) . to eq ( '<div>bar</div>' )
29+ expect ( render_to_html ( Foo , foo : :bar ) ) . to eq ( '<div>bar</div>' )
3130 end
3231
3332 it "can create and access an optional params" do
@@ -44,7 +43,7 @@ def render
4443 end
4544 end
4645
47- expect ( React . render_to_static_markup ( React . create_element ( Foo , { foo1 : :bar1 , foo3 : :bar3 } ) ) ) . to eq ( '<div>bar1-no_bar2-bar3-no_bar4</div>' )
46+ expect ( render_to_html ( Foo , foo1 : :bar1 , foo3 : :bar3 ) ) . to eq ( '<div>bar1-no_bar2-bar3-no_bar4</div>' )
4847 end
4948
5049 it 'can specify validation rules with the type option' do
@@ -68,7 +67,7 @@ def render
6867 end
6968 end
7069
71- expect ( React . render_to_static_markup ( React . create_element ( Foo , { foo1 : 12 , foo2 : "string" } ) ) ) . to eq ( '<div>12-string</div>' )
70+ expect ( render_to_html ( Foo , foo1 : 12 , foo2 : "string" ) ) . to eq ( '<div>12-string</div>' )
7271 end
7372
7473 it 'logs error in warning if validation failed' do
@@ -163,8 +162,8 @@ def render
163162 "#{ params . bar . kind } , #{ params . baz [ 0 ] . kind } "
164163 end
165164 end
166- expect ( React . render_to_static_markup ( React . create_element (
167- Foo , foo : "" , bar : { bazwoggle : 1 } , baz : [ { bazwoggle : 2 } ] ) ) ) . to eq ( '<span>1, 2</span>' )
165+ expect ( render_to_html (
166+ Foo , foo : "" , bar : { bazwoggle : 1 } , baz : [ { bazwoggle : 2 } ] ) ) . to eq ( '<span>1, 2</span>' )
168167 expect ( `window.dummy_log` ) . to eq ( [ "Warning: Failed propType: In component `Foo`\n Provided prop `foo` could not be converted to BazWoggle" ] )
169168 end
170169
@@ -175,7 +174,7 @@ def render
175174 params . foo
176175 end
177176 end
178- expect ( React . render_to_static_markup ( React . create_element ( Foo , foo : lambda { 'works!' } ) ) ) . to eq ( '<span>works!</span>' )
177+ expect ( render_to_html ( Foo , foo : lambda { 'works!' } ) ) . to eq ( '<span>works!</span>' )
179178 end
180179
181180 it "will create a 'bang' (i.e. update) method if the type is React::Observable" do
@@ -190,7 +189,7 @@ def render
190189 end
191190 current_state = ""
192191 observer = React ::Observable . new ( current_state ) { |new_state | current_state = new_state }
193- expect ( React . render_to_static_markup ( React . create_element ( Foo , foo : observer ) ) ) . to eq ( '<span>ha!</span>' )
192+ expect ( render_to_html ( Foo , foo : observer ) ) . to eq ( '<span>ha!</span>' )
194193 expect ( current_state ) . to eq ( "ha!" )
195194 end
196195 end
0 commit comments