Skip to content
Snippets Groups Projects
Verified Commit dd740160 authored by Loïs Poujade's avatar Loïs Poujade
Browse files

Update VideoViewer component test file

still todo: fix captions tests
parent b11d8c4d
No related branches found
No related tags found
Loading
import React from 'react';
import { shallow } from 'enzyme';
import { Utils } from 'manifesto.js';
import { VideoViewer } from '../../../src/components/VideoViewer';
import videoSimple from '../../fixtures/version-3/video.json';
// import videoSubtitles from '../../fixtures/version-3/video_subtitles.json';
/** create wrapper */
function createWrapper(props, suspenseFallback) {
......@@ -16,36 +19,26 @@ function createWrapper(props, suspenseFallback) {
describe('VideoViewer', () => {
let wrapper;
describe('render', () => {
const canvasSimple = Utils.parseManifest(videoSimple).getSequences()[0].getCanvases()[0];
it('videoResources', () => {
wrapper = createWrapper({
videoResources: [
{ getFormat: () => 'video/mp4', id: 1 },
{ getFormat: () => 'video/mp4', id: 2 },
],
canvas: canvasSimple,
}, true);
expect(wrapper.contains(<source src={1} type="video/mp4" />)).toBe(true);
expect(wrapper.contains(<source src={2} type="video/mp4" />)).toBe(true);
expect(wrapper.contains(<source src="https://fixtures.iiif.io/video/indiana/30-minute-clock/medium/30-minute-clock.mp4" type="video/mp4" />)).toBe(true);
});
it('passes through configurable options', () => {
wrapper = createWrapper({
videoResources: [
{ getFormat: () => 'video/mp4', id: 1 },
],
canvas: canvasSimple,
}, true);
expect(wrapper.exists('video[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
});
it('captions', () => {
wrapper = createWrapper({
captions: [
{ getDefaultLabel: () => 'English', getProperty: () => 'en', id: 1 },
{ getDefaultLabel: () => 'French', getProperty: () => 'fr', id: 2 },
],
videoResources: [
{ getFormat: () => 'video/mp4', id: 1 },
],
}, true);
expect(wrapper.contains(<track src={1} label="English" srcLang="en" />)).toBe(true);
expect(wrapper.contains(<track src={2} label="French" srcLang="fr" />)).toBe(true);
});
// it('captions', () => {
// const canvases = Utils.parseManifest(videoSubtitles).getSequences()[0].getCanvases();
// wrapper = createWrapper({
// // annotations: ?
// canvas: canvases[0],
// }, true);
// expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt" />)).toBe(true);
// });
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment