From 0f89c19a0c9b81031ecc86c8e0f38d4c282ca71e Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Tue, 14 Mar 2017 12:22:09 -0400 Subject: [PATCH 1/2] Update refs to callbacks for Fiber compat --- src/Modal.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Modal.js b/src/Modal.js index dc29d18..b356f78 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -40,7 +40,7 @@ export default class ReactModal2 extends React.Component { componentDidMount() { if (ExecutionEnvironment.canUseDOM) { - setFocusOn(ReactModal2.getApplicationElement(), this.refs.modal); + setFocusOn(ReactModal2.getApplicationElement(), this.modal); document.addEventListener('keydown', this.handleDocumentKeydown); } } @@ -70,11 +70,11 @@ export default class ReactModal2 extends React.Component { render() { return ( -
this.backdrop = i} className={this.props.backdropClassName} style={this.props.backdropStyles} onClick={this.handleBackdropClick}> -
this.modal = i} className={this.props.modalClassName} style={this.props.modalStyles} onClick={this.handleModalClick} From 6e45c34a812aad697ba2e563c769d606b3cffd62 Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Tue, 14 Mar 2017 12:27:51 -0400 Subject: [PATCH 2/2] Update tests for ref callbacks --- test/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/index.js b/test/index.js index fa7d065..e995f41 100644 --- a/test/index.js +++ b/test/index.js @@ -48,7 +48,7 @@ describe('ReactModal2', function() { var dom = ; var instance = ReactDOM.render(dom, this.root); - TestUtils.Simulate.click(instance.refs.backdrop); + TestUtils.Simulate.click(instance.backdrop); expect(called).to.be.true; }); @@ -60,7 +60,7 @@ describe('ReactModal2', function() { var dom = ; var instance = ReactDOM.render(dom, this.root); - TestUtils.Simulate.click(instance.refs.backdrop); + TestUtils.Simulate.click(instance.backdrop); expect(called).to.be.false; }); @@ -72,7 +72,7 @@ describe('ReactModal2', function() { var dom = ; var instance = ReactDOM.render(dom, this.root); - TestUtils.Simulate.click(instance.refs.modal); + TestUtils.Simulate.click(instance.modal); expect(called).to.be.false; }); @@ -85,7 +85,7 @@ describe('ReactModal2', function() { var dom = ; var instance = ReactDOM.render(dom, this.root); - expect(instance.refs.modal).to.equal(document.activeElement); + expect(instance.modal).to.equal(document.activeElement); document.body.removeChild(input); });