ldx-widgets
Version:
widgets
76 lines (56 loc) • 1.76 kB
text/coffeescript
React = require 'react'
PropTypes = require 'prop-types'
createClass = require 'create-react-class'
ReactDOM = require 'react-dom'
{div} = require 'react-dom-factories'
assign = require 'lodash/assign'
ContextWrapper = createClass
childContextTypes:
clearValidationError: PropTypes.func
addValidationError: PropTypes.func
getValidationStatus: PropTypes.func
toggleValidationError: PropTypes.func
setTabErrorAnchors: PropTypes.func
openOverlay: PropTypes.func
closeOverlay: PropTypes.func
getChildContext: ->
= sinon.spy()
= sinon.spy()
= sinon.spy()
= sinon.spy()
= sinon.spy()
= sinon.spy()
= sinon.spy()
{
}
componentWillMount: ->
= .childProps?.ref or 'input'
render: ->
{factory, childProps, children} =
props = assign {}, childProps, {ref: }
div {
key: 'wrapper'
}, children or factory(props)
getInput: ->
[]
getInputEl: ->
ReactDOM.findDOMNode([])
getValidationSpies: ->
{
}
getValidationStatusStub: ->
{error, forceShowAllErrors} =
error = if error? then error else null
forceShowAllErrors = if forceShowAllErrors is yes then yes else no
{error, forceShowAllErrors}
module.exports = React.createFactory(ContextWrapper)