Skip to content

Commit

Permalink
Add regression test for scry order
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebits committed Feb 26, 2015
1 parent 1c697ab commit feae9ad
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/__tests__/ReactTestUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,31 @@ describe('ReactTestUtils', function() {
expect(scryResults.length).toBe(0);

});

it('traverses children in the correct order', function() {
var container = document.createElement('div');

React.render(
<div>
{null}
<div>purple</div>
</div>,
container
);
var tree = React.render(
<div>
<div>orange</div>
<div>purple</div>
</div>,
container
);

var log = [];
ReactTestUtils.findAllInRenderedTree(tree, function(child) {
log.push(child.getDOMNode().textContent);
});

// Should be document order, not mount order (which would be purple, orange)
expect(log).toEqual(['orangepurple', 'orange', 'purple']);
});
});

0 comments on commit feae9ad

Please sign in to comment.