Sha256: d3373c9c620156ae84c392e29088c949a5218cd2b25a2946b89bdc45e1ff4e22
Contents?: true
Size: 880 Bytes
Versions: 9
Compression:
Stored size: 880 Bytes
Contents
require 'spec_helper' if opal? class HelloMessage include React::Component def render div { "Hello World!" } end end describe 'An Example from the react.rb doc', type: :component do it 'produces the correct result' do expect(HelloMessage).to render_static_html('<div>Hello World!</div>') end end class HelloMessage2 include React::Component define_state(:user_name) { '@catmando' } def render div { "Hello #{state.user_name}" } end end describe 'Adding state to a component (second tutorial example)', type: :component do it "produces the correct result" do expect(HelloMessage2).to render_static_html('<div>Hello @catmando</div>') end it 'renders to the document' do ele = `document.createElement('div')` React.render(React.create_element(HelloMessage2), ele) expect(`#{ele}.innerHTML`) =~ 'Hello @catmando' end end end
Version data entries
9 entries across 9 versions & 1 rubygems