Skip to content

Commit

Permalink
Failing test for facebook#19608
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 authored and gaearon committed Aug 21, 2020
1 parent 90d212d commit c232f0c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMFiber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,24 @@ describe('ReactDOMFiber', () => {
expect(ops).toEqual([]);
});

it('listens to events that do not exist in the Portal subtree', () => {
const onClick = jest.fn();

const ref = React.createRef();
ReactDOM.render(
<div onClick={onClick}>
{ReactDOM.createPortal(<button ref={ref}>click</button>, document.body)}
</div>,
container,
);
const event = new MouseEvent('click', {
bubbles: true,
});
ref.current.dispatchEvent(event);

expect(onClick).toHaveBeenCalledTimes(1); // 0
});

it('should throw on bad createPortal argument', () => {
expect(() => {
ReactDOM.createPortal(<div>portal</div>, null);
Expand Down

0 comments on commit c232f0c

Please sign in to comment.