Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Feb 10, 2022
1 parent ac9658e commit b855377
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/react/src/components/Callout/Callout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ describe('Callout', () => {
});

it('does not throw with target MouseEvent', () => {
const mouseEvent = document.createEvent('MouseEvent');
const eventTarget = document.createElement('div');
mouseEvent.initMouseEvent('click', false, false, window, 0, 0, 0, 0, 0, false, false, false, false, 1, eventTarget);
const mouseEvent = new MouseEvent('click', { relatedTarget: eventTarget });

expect(() => {
render(
<div>
<Callout target={eventTarget} directionalHint={DirectionalHint.topLeftEdge}>
<Callout target={mouseEvent} directionalHint={DirectionalHint.topLeftEdge}>
<div>Content</div>
</Callout>
</div>,
Expand Down Expand Up @@ -154,8 +153,7 @@ describe('Callout', () => {
jest.spyOn(window.document, 'activeElement', 'get').mockReturnValue(focusedElement as Element);

const onRestoreFocus = jest.fn();
// In order to have eventlisteners that have been added to the window to be called the JSX needs
// to be rendered into the real dom rather than the testutil simulated dom.

const { getByText, unmount } = render(
<div>
<button id="target" style={{ top: '10px', left: '10px', height: '0', width: '0px' }}>
Expand Down

0 comments on commit b855377

Please sign in to comment.