import { h } from 'preact';
import { axe } from 'jest-axe';
import { render } from '@testing-library/preact';
import { VideoContent } from '../videoContent';
describe('', () => {
it('should have no a11y violations', async () => {
const { container } = render(
,
);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should render in fullscreen', () => {
const { queryByLabelText } = render(
,
);
expect(queryByLabelText('Leave fullscreen')).toBeNull();
expect(queryByLabelText('Fullscreen')).toBeDefined();
});
it('should not render in fullscreen', () => {
const { queryByLabelText } = render(
,
);
expect(queryByLabelText('Fullscreen')).toBeNull();
expect(queryByLabelText('Leave fullscreen')).toBeDefined();
});
it('should trigger video content when clicked', () => {
const onTriggerVideoContent = jest.fn();
const { getByTestId } = render(
,
);
getByTestId('connect-video').click();
expect(onTriggerVideoContent).toHaveBeenCalledTimes(1);
});
it('should load the given video', () => {
const onTriggerVideoContent = jest.fn();
const { getByTitle } = render(
,
);
const videoFrame = getByTitle('Video display');
expect(videoFrame.getAttribute('src')).toEqual('/some-video-path');
});
});