Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
storeGetter: { storeKey: 'foo' }
}
render() {
return
}
}
const tree = TestUtils.renderIntoDocument(
)
const target = TestUtils.findRenderedComponentWithType(tree, Passthrough)
const wrapper = TestUtils.findRenderedComponentWithType(tree, StatefulWrapper)
expect(mapStateSpy.calls.length).toBe(2)
expect(mapDispatchSpy.calls.length).toBe(2)
expect(target.props.statefulValue).toEqual('foo')
// Impure update
const storeGetter = wrapper.state.storeGetter
storeGetter.storeKey = 'bar'
wrapper.setState({ storeGetter })
expect(mapStateSpy.calls.length).toBe(3)
expect(mapDispatchSpy.calls.length).toBe(3)
expect(target.props.statefulValue).toEqual('bar')
})
it('should render the context menu', () => {
let contextMenu = ReactTestUtils.findRenderedComponentWithType(componentWithContextMenu, ContextMenu);
expect(contextMenu).toBeDefined();
});
it('renders first child passed', function() {
const scene = renderIntoDocument(
);
const child = findRenderedComponentWithType(scene, Child);
expect(child).to.be.ok;
});
it("Shows a list of predefined breakpoints", function(){
var availableBreakpointsListComponent = TestUtils.findRenderedComponentWithType(
component,
AvailableBreakpointsList
);
var listNode = ReactDOM.findDOMNode(availableBreakpointsListComponent);
expect(listNode.children.length).toBe(predefinedBreakpoints.length)
})
function byType(node, type) {
return TestUtils.findRenderedComponentWithType(node, type);
}
function click(node) {
constructor(props) {
super(props)
this.state = { pass: '' }
}
render() {
return (
)
}
}
const tree = TestUtils.renderIntoDocument()
const stub = TestUtils.findRenderedComponentWithType(tree, Passthrough)
expect(spy.calls.length).toBe(1)
expect(stub.props.string).toBe('')
expect(stub.props.pass).toBe('')
store.dispatch({ type: 'APPEND', body: 'a' })
expect(spy.calls.length).toBe(2)
expect(stub.props.string).toBe('a')
expect(stub.props.pass).toBe('')
tree.setState({ pass: '' })
expect(spy.calls.length).toBe(2)
expect(stub.props.string).toBe('a')
expect(stub.props.pass).toBe('')
tree.setState({ pass: 'through' })
expect(spy.calls.length).toBe(3)
const makeChild = () => {
const tree = TestUtils.renderIntoDocument(
);
return TestUtils.findRenderedComponentWithType(tree, Child);
};
beforeEach(() => {
component = TestUtils.renderIntoDocument(
);
calendar = TestUtils.findRenderedComponentWithType(component, Calendar);
});
mapStateToProps: state => state,
mapDispatchToProps: dispatch => ({ dispatch })
})(Container);
const container = TestUtils.renderIntoDocument(
);
const stub = TestUtils.findRenderedComponentWithType(container, Passthrough);
expect(stub.props.dispatch).toEqual(store.dispatch);
expect(stub.props.foo).toEqual('bar');
expect(() =>
TestUtils.findRenderedComponentWithType(container, Container)
).toNotThrow();
const decorated = TestUtils.findRenderedComponentWithType(container, Container);
expect(decorated.isSubscribed()).toBe(true);
});
return (
)
}
}
const restoreDisplay = setDisplayClientBoundingRect({
width: 400,
height: 400
})
const tree = TestUtils.renderIntoDocument(
)
const display = TestUtils.findRenderedComponentWithType(tree, Display)
const expectedHeight = 400
expect(display.state.height)
.toEqual(expectedHeight)
restoreDisplay()
})