Sha256: dda0802ec7a7bc236f3bb21ddb6c5f589b173adad7472a9bff253bfd8b25bdd1
Contents?: true
Size: 856 Bytes
Versions: 1
Compression:
Stored size: 856 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('<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('<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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper-react-0.10.0 | spec/react/tutorial/tutorial_spec.rb |