diff --git a/src/CSSTransition.js b/src/CSSTransition.js index f8e3e2d..58de70a 100644 --- a/src/CSSTransition.js +++ b/src/CSSTransition.js @@ -173,9 +173,10 @@ class CSSTransition extends React.Component { addClass(node, type, phase) { let className = this.getClassNames(type)[`${phase}ClassName`]; + const { doneClassName } = this.getClassNames('enter'); - if (type === 'appear' && phase === 'done') { - className += ` ${this.getClassNames('enter').doneClassName}`; + if (type === 'appear' && phase === 'done' && doneClassName) { + className += ` ${doneClassName}`; } // This is for to force a repaint, @@ -185,8 +186,10 @@ class CSSTransition extends React.Component { node && node.scrollTop; } - this.appliedClasses[type][phase] = className - addClass(node, className) + if (className) { + this.appliedClasses[type][phase] = className + addClass(node, className) + } } removeClasses(node, type) { diff --git a/test/CSSTransition-test.js b/test/CSSTransition-test.js index 5715faa..3e5f976 100644 --- a/test/CSSTransition-test.js +++ b/test/CSSTransition-test.js @@ -165,7 +165,29 @@ describe('CSSTransition', () => {
) - }) + }); + + it('should not add undefined when appearDone is not defined', done => { + mount( +