mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 01:48:18 +03:00
10 lines
408 B
TypeScript
10 lines
408 B
TypeScript
import { ReactElement } from 'react';
|
|
import { render } from '@testing-library/react';
|
|
|
|
export const setUpCanvas = (element: ReactElement) => {
|
|
const result = render(element);
|
|
const { container } = result;
|
|
const getEvents = () => container.querySelector('canvas')?.getContext('2d')?.__getEvents(); // eslint-disable-line no-underscore-dangle
|
|
|
|
return { ...result, events: getEvents(), getEvents };
|
|
};
|