mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
ReactTransitions: Don't animate undefined children
This commit is contained in:
committed by
Paul O’Shannessy
parent
4915a63973
commit
012ac24728
@@ -44,6 +44,11 @@ var ReactTransitionGroupMixin = {
|
||||
'getTransitionConfig() method.'
|
||||
);
|
||||
|
||||
// don't animate undefined children
|
||||
if (typeof sourceChildren === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var children = {};
|
||||
var childMapping = ReactTransitionKeySet.getChildMapping(sourceChildren);
|
||||
var transitionConfig = this.getTransitionConfig();
|
||||
|
||||
@@ -26,18 +26,18 @@ var mocks;
|
||||
// Most of the real functionality is covered in other unit tests, this just
|
||||
// makes sure we're wired up correctly.
|
||||
describe('ReactTransitionGroup', function() {
|
||||
var container;
|
||||
|
||||
beforeEach(function() {
|
||||
React = require('React');
|
||||
ReactTransitionGroup = require('ReactTransitionGroup');
|
||||
mocks = require('mocks');
|
||||
|
||||
container = document.createElement('div');
|
||||
});
|
||||
|
||||
it('should warn after time with no transitionend', function() {
|
||||
var container;
|
||||
var a;
|
||||
|
||||
container = document.createElement('div');
|
||||
a = React.renderComponent(
|
||||
var a = React.renderComponent(
|
||||
<ReactTransitionGroup transitionName="yolo">
|
||||
<span key="one" id="one" />
|
||||
</ReactTransitionGroup>,
|
||||
@@ -65,7 +65,6 @@ describe('ReactTransitionGroup', function() {
|
||||
});
|
||||
|
||||
it('should keep both sets of DOM nodes around', function() {
|
||||
var container = document.createElement('div');
|
||||
var a = React.renderComponent(
|
||||
<ReactTransitionGroup transitionName="yolo">
|
||||
<span key="one" id="one" />
|
||||
@@ -83,4 +82,14 @@ describe('ReactTransitionGroup', function() {
|
||||
expect(a.getDOMNode().childNodes[0].id).toBe('two');
|
||||
expect(a.getDOMNode().childNodes[1].id).toBe('one');
|
||||
});
|
||||
|
||||
describe('with an undefined child', function () {
|
||||
it('should fail silently', function () {
|
||||
var a = React.renderComponent(
|
||||
<ReactTransitionGroup transitionName="yolo">
|
||||
</ReactTransitionGroup>,
|
||||
container
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user