Skip to content

Commit

Permalink
Merge pull request #6633 from gaearon/native-tree-devtool
Browse files Browse the repository at this point in the history
Make ReactComponentTreeDevtool work with React Native
(cherry picked from commit 45ec126)
  • Loading branch information
gaearon authored and zpao committed May 10, 2016
1 parent 09c6d53 commit cba62fe
Show file tree
Hide file tree
Showing 6 changed files with 1,754 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ describe('ReactComponentTreeDevtool', () => {
return getTree(rootInstance._debugID, options).children[0];
}

// Mount once, render updates, then unmount.
// Ensure the tree is correct on every step.
pairs.forEach(([element, expectedTree]) => {
currentElement = element;
ReactDOM.render(<Wrapper />, node);
Expand All @@ -101,17 +103,17 @@ describe('ReactComponentTreeDevtool', () => {
expect(getActualTree()).toEqual(expectedTree);
});
ReactDOM.unmountComponentAtNode(node);

ReactComponentTreeDevtool.purgeUnmountedComponents();
expect(getActualTree()).toBe(undefined);
expect(getRootDisplayNames()).toEqual([]);
expect(getRegisteredDisplayNames()).toEqual([]);

// Server render every pair.
// Ensure the tree is correct on every step.
pairs.forEach(([element, expectedTree]) => {
currentElement = element;
ReactDOMServer.renderToString(<Wrapper />);
expect(getActualTree()).toEqual(expectedTree);

ReactComponentTreeDevtool.purgeUnmountedComponents();
expect(getActualTree()).toBe(undefined);
expect(getRootDisplayNames()).toEqual([]);
Expand Down
Loading

0 comments on commit cba62fe

Please sign in to comment.