This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module React
22 module Test
33 class Session
44 DSL_METHODS = %i[ mount instance native element update_params
5- force_update! ] . freeze
5+ force_update! html ] . freeze
66
77 def mount ( component_klass , params = { } )
88 @element = React . create_element ( component_klass , params )
@@ -29,6 +29,10 @@ def update_params(params)
2929 def force_update!
3030 instance . force_update!
3131 end
32+
33+ def html
34+ React . render_to_static_markup ( element )
35+ end
3236 end
3337 end
3438end
Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ def render
5656 end
5757 end
5858
59+ describe '#html' do
60+ it 'returns the component rendered to static html' do
61+ subject . mount ( Greeter , message : 'world' )
62+ expect ( subject . html ) . to eq ( '<span>Hello world</span>' )
63+ end
64+ end
65+
5966 describe '#update_params' do
6067 it 'sends new params to the component' do
6168 instance = subject . mount ( Greeter , message : 'world' )
You can’t perform that action at this time.
0 commit comments