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