mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Merge pull request #5164 from zpao/fix-csstransitiongroup-proptype
Correctly handle 0 in CSSTransitionGroup timeout props
(cherry picked from commit af99b2c2a3)
This commit is contained in:
1 parent
fdb2486b98
commit
84f6915315
2 files changed
+18
-1
No files matched your search
@@ -27,7 +27,7 @@ function createTransitionTimeoutPropValidator(transitionType) {
|
||||
// If the transition is enabled
|
||||
if (props[enabledPropName]) {
|
||||
// If no timeout duration is provided
|
||||
if (!props[timeoutPropName]) {
|
||||
if (props[timeoutPropName] == null) {
|
||||
return new Error(
|
||||
timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' +
|
||||
'this can cause unreliable animations and won\'t be supported in ' +
|
||||
|
||||
@@ -23,6 +23,7 @@ describe('ReactCSSTransitionGroup', function() {
|
||||
var container;
|
||||
|
||||
beforeEach(function() {
|
||||
require('mock-modules').dumpCache();
|
||||
React = require('React');
|
||||
ReactDOM = require('ReactDOM');
|
||||
ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
|
||||
@@ -47,6 +48,22 @@ describe('ReactCSSTransitionGroup', function() {
|
||||
expect(console.error.argsForCall.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should not warn if timeouts is zero', function() {
|
||||
ReactDOM.render(
|
||||
<ReactCSSTransitionGroup
|
||||
transitionName="yolo"
|
||||
transitionEnter={false}
|
||||
transitionLeave={true}
|
||||
transitionLeaveTimeout={0}
|
||||
>
|
||||
<span key="one" id="one" />
|
||||
</ReactCSSTransitionGroup>,
|
||||
container
|
||||
);
|
||||
|
||||
expect(console.error.argsForCall.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should clean-up silently after the timeout elapses', function() {
|
||||
var a = ReactDOM.render(
|
||||
<ReactCSSTransitionGroup
|
||||
|
||||
Reference in new issue
Block a user