Sha256: 461543c7267747c92416a99022311d4ca5169e2c9fe9315c264f061390c32c73
Contents?: true
Size: 805 Bytes
Versions: 3
Compression:
Stored size: 805 Bytes
Contents
require 'react' module ReactTestHelpers `var ReactTestUtils = React.addons.TestUtils` def renderToDocument(type, options = {}) element = React.create_element(type, options) return renderElementToDocument(element) end def renderElementToDocument(element) instance = Native(`ReactTestUtils.renderIntoDocument(#{element})`) instance.class.include(React::Component::API) return instance end def simulateEvent(event, component, params = {}) simulator = Native(`ReactTestUtils.Simulate`) simulator[event.to_s].call(`#{component.to_n}.getDOMNode()`, params) end def isElementOfType(element, type) `React.addons.TestUtils.isElementOfType(#{element}, #{type.cached_component_class})` end end RSpec.configure do |config| config.include ReactTestHelpers end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
react.rb-0.3.0 | spec/spec_helper.rb |
react.rb-0.2.1 | spec/spec_helper.rb |
react.rb-0.2.0 | spec/spec_helper.rb |