forked from patternfly/react-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXTerm.test.tsx
More file actions
25 lines (22 loc) · 780 Bytes
/
XTerm.test.tsx
File metadata and controls
25 lines (22 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { render } from '@testing-library/react';
import { XTerm } from './XTerm';
describe('XTerm', () => {
beforeAll(() => {
window.HTMLCanvasElement.prototype.getContext = () =>
({ canvas: {}, createLinearGradient: jest.fn(), fillRect: jest.fn() } as any);
global.window.matchMedia = () => ({
addListener: jest.fn(),
removeListener: jest.fn(),
matches: true,
media: undefined,
onchange: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn()
});
});
test('Render empty XTerm component', () => {
const { asFragment } = render(<XTerm cols={15} rows={60} onTitleChanged={jest.fn()} onData={jest.fn()} />);
expect(asFragment()).toMatchSnapshot();
});
});