Sha256: f6dc001cc0862c6a45607764088a319bc238ee00d158d6072e6c133659d43bb8

Contents?: true

Size: 723 Bytes

Versions: 8

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'

if RUBY_ENGINE == 'opal' 
  RSpec.describe React::Test::Utils do
    it 'simulates' do
      stub_const 'Foo', Class.new
      Foo.class_eval do
        include React::Component

        def render
          div { 'Click Me' }.on(:click) { |e| click(e) }
        end
      end

      instance = React::Test::Utils.render_into_document(React.create_element(Foo))
      expect(instance).to receive(:click)
      described_class.simulate(:click, instance.dom_node)
    end

    describe "render_into_document" do
      it "works with native element" do
        expect {
          described_class.render_into_document(React.create_element('div'))
        }.to_not raise_error
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyper-react-1.0.0.lap28 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap27 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap26 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap25 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap24 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap23 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap22 spec/react/test/utils_spec.rb
hyper-react-1.0.0.lap21 spec/react/test/utils_spec.rb