Created
August 25, 2015 20:09
-
-
Save dtothefp/8af801f826302631575c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mockNuclearDec = mockNuclearComponent({formState, formValidation}); | |
HigherOrderInput.__Rewire__('nuclearComponent', mockNuclearDec); | |
let HigherOrderComponent = HigherOrderInput(Input); | |
let hoc = TestUtils.renderIntoDocument( | |
<HigherOrderComponent {...mockProps} /> | |
); | |
let hocElm = React.findDOMNode(hoc); | |
let inputObj = TestUtils.findRenderedDOMComponentWithClass(hoc, 'one'); | |
let inputElm = inputObj.getDOMNode(); | |
it('the higher order component should contain an input', () => { | |
let allInputs = hocElm.querySelectorAll('input'); | |
expect(allInputs.length).to.eq(1); | |
}); | |
it('should have an initial value from the store', () => { | |
expect(inputElm.value).to.eq('initial value'); | |
}); | |
it('should update it\'s value `onChange` ', () => { | |
//TODO: figure out how to re-render input | |
//currently must get props from React Object and value does not update on DOM node | |
inputElm.value = 'updated'; | |
Simulate.change(inputElm); | |
expect(inputObj.props.value).to.eq('updated'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment