Skip to content

Commit

Permalink
Test the update path as well
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-spiess committed Jun 2, 2018
1 parent 931bc7d commit 4de2539
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions packages/react-dom/src/__tests__/ReactDOMFiber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,28 @@ describe('ReactDOMFiber', () => {
});

it('renders an empty fragment', () => {
const Div = () => <div />;
const EmptyFragment = () => <React.Fragment />;
const NonEmptyFragment = () => (
<React.Fragment>
<Div />
</React.Fragment>
);

let instance = null;
ReactDOM.render(<EmptyFragment />, container);
expect(container.firstChild).toBe(null);

expect(container.childNodes.length).toBe(0);
ReactDOM.render(<NonEmptyFragment />, container);
expect(container.firstChild.tagName).toBe('DIV');

const firstNode = ReactDOM.findDOMNode(instance);
expect(firstNode).toBe(null);
ReactDOM.render(<EmptyFragment />, container);
expect(container.firstChild).toBe(null);

ReactDOM.render(<Div />, container);
expect(container.firstChild.tagName).toBe('DIV');

ReactDOM.render(<EmptyFragment />, container);
expect(container.firstChild).toBe(null);
});

let svgEls, htmlEls, mathEls;
Expand Down

0 comments on commit 4de2539

Please sign in to comment.