diff --git a/src/CSSTransition.js b/src/CSSTransition.js index f9a30224..aa01358d 100644 --- a/src/CSSTransition.js +++ b/src/CSSTransition.js @@ -116,10 +116,10 @@ class CSSTransition extends React.Component { const { className } = this.getClassNames(appearing ? 'appear' : 'enter') this.removeClasses(node, 'exit'); - addClass(node, className) + addClass(node, className); if (this.props.onEnter) { - this.props.onEnter(node) + this.props.onEnter(node, appearing); } } @@ -128,10 +128,10 @@ class CSSTransition extends React.Component { appearing ? 'appear' : 'enter' ); - this.reflowAndAddClass(node, activeClassName) + this.reflowAndAddClass(node, activeClassName); if (this.props.onEntering) { - this.props.onEntering(node) + this.props.onEntering(node, appearing); } } @@ -142,7 +142,7 @@ class CSSTransition extends React.Component { addClass(node, doneClassName); if (this.props.onEntered) { - this.props.onEntered(node) + this.props.onEntered(node, appearing); } } diff --git a/test/CSSTransition-test.js b/test/CSSTransition-test.js index 6d4a1e40..94355dcb 100644 --- a/test/CSSTransition-test.js +++ b/test/CSSTransition-test.js @@ -89,7 +89,8 @@ describe('CSSTransition', () => { >
- ); + ) + .render(); instance.setProps({ in: true, @@ -111,6 +112,70 @@ describe('CSSTransition', () => { } }); }); + + describe('isAppearing', () => { + + it('should be false', done => { + + instance = tsp( + +
+ + ) + .render(); + + + instance.props({ + in: true, + onEnter(node, isAppearing){ + expect(isAppearing).toEqual(false); + }, + + onEntering(node, isAppearing){ + expect(isAppearing).toEqual(false); + }, + + onEntered(node, isAppearing){ + expect(isAppearing).toEqual(false); + done(); + } + }); + }); + + it('should be true', done => { + + instance = tsp( + +
+ + ) + .render(); + + instance.props({ + onEnter(node, isAppearing){ + expect(isAppearing).toEqual(true); + }, + + onEntering(node, isAppearing){ + expect(isAppearing).toEqual(true); + }, + + onEntered(node, isAppearing){ + expect(isAppearing).toEqual(true); + done(); + } + }); + }); + + }); }); describe('exiting', ()=> {