Sha256: 438547b47d9f95c244777fd933c314e4b80a37796e0089674be4085b4f7e44ae

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

require 'spec_helper'

if opal?
describe 'Element' do
  after(:each) do
    React::API.clear_component_class_cache
  end

  it 'renders a top level component using render' do
    test_div = Element.new(:div)
    test_div.render(:span, id: :render_test_span) { 'hello' }
    expect(Element[test_div].find('#render_test_span').html).to eq('hello')
  end

  it 'will find the DOM node given a react element' do
    stub_const 'Foo', Class.new(React::Component::Base)
    Foo.class_eval do
      def render
        div { 'hello' }
      end
    end

    expect(Element[renderToDocument(Foo)].html).to eq('hello')
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reactrb-0.8.4 spec/react/opal_jquery_extensions_spec.rb