diff --git a/src/Modal.js b/src/Modal.js index 6a65d43..0427265 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -296,6 +296,10 @@ const Modal = React.createClass({ addFocusListener(this.enforceFocus); this.focus(); + + if (this.props.onShow) { + this.props.onShow(); + } }, onHide() { diff --git a/test/ModalSpec.js b/test/ModalSpec.js index 5ea28df..7fac6de 100644 --- a/test/ModalSpec.js +++ b/test/ModalSpec.js @@ -261,6 +261,30 @@ describe('Modal', function () { , mountPoint); }); + it('Should fire show callback on mount', function () { + let onShowSpy = sinon.spy(); + render( + + Message + + , mountPoint); + + expect(onShowSpy).to.have.been.calledOnce; + }); + + it('Should fire show callback on update', function () { + let onShowSpy = sinon.spy(); + let instance = render( + + Message + + , mountPoint); + + instance.renderWithProps({ show: true }); + + expect(onShowSpy).to.have.been.calledOnce; + }); + describe('Focused state', function () { let focusableContainer = null;