From 7af8ee5914c3b767c7d58a2b09b2c52e82454d75 Mon Sep 17 00:00:00 2001 From: Cody Marshall Johnston Date: Fri, 8 Apr 2016 21:56:59 -0700 Subject: [PATCH] Update README.md to include testing gotchas (#136) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 042f269c..61d082c0 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,11 @@ var App = React.createClass({ ReactDOM.render(, appElement); ``` +# Testing + +When using React Test Utils with this library, here are some things to keep in mind: +- You need to set isOpen={true} on the modal component for it to render its children. +- You need to use the `.portal` property, as in `ReactDOM.findDOMNode(renderedModal.portal)` or `TestUtils.scryRenderedDOMComponentsWithClass(Modal.portal, 'my-modal-class')` to acquire a handle to the inner contents of your modal. By default the modal is closed when clicking outside of it (the overlay area). If you want to prevent this behavior you can pass the 'shouldCloseOnOverlayClick' prop with 'false' value.