diff --git a/src/modules/Transition/Transition.js b/src/modules/Transition/Transition.js
index f9eea71ec5..aca1e41594 100644
--- a/src/modules/Transition/Transition.js
+++ b/src/modules/Transition/Transition.js
@@ -160,8 +160,11 @@ export default class Transition extends Component {
this.nextStatus = null
this.setSafeState({ status, animating: true }, () => {
+ const durationType = TRANSITION_TYPE[status]
+ const durationValue = normalizeTransitionDuration(duration, durationType)
+
_.invoke(this.props, 'onStart', null, { ...this.props, status })
- setTimeout(this.handleComplete, normalizeTransitionDuration(duration, 'show'))
+ setTimeout(this.handleComplete, durationValue)
})
}
diff --git a/test/specs/modules/Transition/Transition-test.js b/test/specs/modules/Transition/Transition-test.js
index 84f6b5eab8..1e6cf71949 100644
--- a/test/specs/modules/Transition/Transition-test.js
+++ b/test/specs/modules/Transition/Transition-test.js
@@ -327,6 +327,28 @@ describe('Transition', () => {
)
wrapper.setProps({ visible: false })
})
+
+ it('depends on the specified duration', (done) => {
+ const onHide = sandbox.spy()
+ wrapperMount(
+
+
+ ,
+ )
+
+ wrapper.setProps({ visible: false })
+ wrapper.should.have.state('status', Transition.EXITING)
+
+ setTimeout(() => {
+ wrapper.should.have.state('status', Transition.EXITING)
+ }, 100)
+ setTimeout(() => {
+ onHide.should.have.been.calledOnce()
+ wrapper.should.have.state('status', Transition.EXITED)
+
+ done()
+ }, 200)
+ })
})
describe('onShow', () => {
@@ -351,6 +373,27 @@ describe('Transition', () => {
,
)
})
+
+ it('depends on the specified duration', (done) => {
+ const onShow = sandbox.spy()
+ wrapperMount(
+
+
+ ,
+ )
+
+ wrapper.should.have.state('status', Transition.ENTERING)
+
+ setTimeout(() => {
+ wrapper.should.have.state('status', Transition.ENTERING)
+ }, 100)
+ setTimeout(() => {
+ onShow.should.have.been.calledOnce()
+ wrapper.should.have.state('status', Transition.ENTERED)
+
+ done()
+ }, 200)
+ })
})
describe('onStart', () => {