Sha256: 7c6b6a1ad82aaae75aea322fc15b6f223b95c6446073b1fc6c2308329d090bf0

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

Lanes.Test.renderComponent = (component, args = {}) ->
    props   = args.props || {}
    options = args.options || {}
    wrapper = React.createClass
        makePath: Lanes.emptyFn
        childContextTypes:
            viewport: Lanes.PropTypes.State
            router: React.PropTypes.func
            routeDepth: React.PropTypes.number
        getChildContext: ->
            viewport: new Lanes.React.Viewport
            router: Lanes.Test.stubRouterContext(options.router)
            routeDepth: 0
        render: ->
            React.createElement(component, props)

    wrapper = Lanes.Test.Utils.renderIntoDocument(
        React.createElement(wrapper)
    )

    Lanes.Test.Utils.findRenderedComponentWithType(wrapper, component)



Lanes.Test.Utils = Lanes.Vendor.ReactTestUtils

wrap = (name) ->
    ->
        Lanes.Test.Utils.Simulate[name](@el, arguments...)
        return @

for name, func of Lanes.Test.Utils.Simulate
    Lanes.lib.Dom::[name] = wrap(name, func)

Lanes.lib.Dom::setValue = (value) ->
    @setAttribute('value', value).change()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lanes-0.4.0 client/lanes/testing/Helpers.coffee
lanes-0.3.0 client/lanes/testing/Helpers.coffee