diff --git a/src/CSSTransition.js b/src/CSSTransition.js
index 8761d41..d697dd8 100644
--- a/src/CSSTransition.js
+++ b/src/CSSTransition.js
@@ -130,7 +130,7 @@ class CSSTransition extends React.Component {
addClass(node, className)
if (this.props.onEnter) {
- this.props.onEnter(node)
+ this.props.onEnter(node, appearing)
}
}
@@ -142,7 +142,7 @@ class CSSTransition extends React.Component {
this.reflowAndAddClass(node, activeClassName)
if (this.props.onEntering) {
- this.props.onEntering(node)
+ this.props.onEntering(node, appearing)
}
}
@@ -153,7 +153,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 6d4a1e4..b04fff1 100644
--- a/test/CSSTransition-test.js
+++ b/test/CSSTransition-test.js
@@ -113,6 +113,97 @@ describe('CSSTransition', () => {
});
});
+ describe('appearing', () => {
+ it('should apply appear classes at each transition state', done => {
+ let count = 0;
+ mount(
+ {
+ count++;
+ expect(isAppearing).toEqual(true);
+ expect(node.className).toEqual('appear-test-appear');
+ }}
+ onEntering={(node, isAppearing) => {
+ count++;
+ expect(isAppearing).toEqual(true);
+ expect(node.className).toEqual('appear-test-appear appear-test-appear-active');
+ }}
+
+ onEntered={(node, isAppearing) => {
+ expect(isAppearing).toEqual(true);
+ expect(node.className).toEqual('appear-test-enter-done');
+ expect(count).toEqual(2);
+ done();
+ }}
+ >
+
+
+ );
+ });
+
+ it('should not be appearing in normal enter mode', done => {
+ let count = 0;
+ mount(
+
+
+
+ ).setProps({
+ in: true,
+
+ onEnter(node, isAppearing){
+ count++;
+ expect(isAppearing).toEqual(false);
+ expect(node.className).toEqual('not-appear-test-enter');
+ },
+
+ onEntering(node, isAppearing){
+ count++;
+ expect(isAppearing).toEqual(false);
+ expect(node.className).toEqual('not-appear-test-enter not-appear-test-enter-active');
+ },
+
+ onEntered(node, isAppearing){
+ expect(isAppearing).toEqual(false);
+ expect(node.className).toEqual('not-appear-test-enter-done');
+ expect(count).toEqual(2);
+ done();
+ }
+ });
+ });
+
+ it('should not enter the transition states when appear=false', () => {
+ mount(
+ {
+ throw Error('Enter called!')
+ }}
+ onEntering={() => {
+ throw Error('Entring called!')
+ }}
+ onEntered={() => {
+ throw Error('Entred called!')
+ }}
+ >
+
+
+ );
+ });
+
+
+ });
+
describe('exiting', ()=> {
let instance;