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