Skip to content
Snippets Groups Projects
Select Git revision
  • aafcef5dc0203be27e24414b70adf00d11a7bdfe
  • main default
  • 35-cgu
  • 34-peertube-support
  • 27-add-autoplay-to-iframe
  • 33-bug-on-youtube-embed-urls
  • RC-Rekall-v1.1-fix_lpo
  • tuleap-140-go-back-to-my-capsules-page-when-i-m-on-capsule-preview-page
  • RC-Rekall-v1.2-fix10
  • RC-Rekall-v1.2-fix9
  • RC-Rekall-v1.2-fix8
  • RC-Rekall-v1.2-fix7
  • RC-Rekall-v1.2-fix6
  • RC-Rekall-v1.2-fix5
  • RC-Rekall-v1.2-fix4
  • RC-Rekall-v1.2-fix3
  • RC-Rekall-v1.2-fix2
  • RC-Rekall-v1.2-fix1
  • RC-Rekall-v1.1-fix-3
  • RC-Rekall-v1.1-fix-2
  • RC-Rekall-v1.1-fix-1
  • RC-Rekall-v1.1-delivered
  • preprod20220209-1535
23 results

phpstan.neon

Blame
  • VideoViewer.test.js 3.75 KiB
    import React from 'react';
    import { shallow } from 'enzyme';
    import { Utils } from 'manifesto.js';
    import AnnotationFactory from '../../../src/lib/AnnotationFactory';
    import { VideoViewer } from '../../../src/components/VideoViewer';
    import videoSimple from '../../fixtures/version-3/video.json';
    import videoCaptions from '../../fixtures/version-3/video_captions.json';
    import videoMultiCaptions from '../../fixtures/version-3/video_multiples_captions.json';
    import videoMultiCaptionsMultiAnno from '../../fixtures/version-3/video_captions_other.json';
    
    /** create wrapper */
    function createWrapper(props, suspenseFallback) {
      return shallow(
        <VideoViewer
          classes={{}}
          videoOptions={{ crossOrigin: 'anonymous' }}
          {...props}
        />,
      );
    }
    
    describe('VideoViewer', () => {
      let wrapper;
      describe('render', () => {
        it('video', () => {
          wrapper = createWrapper({
            canvas: Utils.parseManifest(videoSimple).getSequences()[0].getCanvases()[0],
          }, true);
          expect(wrapper.exists('video[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
          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('one caption', () => {
          const canvas = Utils.parseManifest(videoCaptions).getSequences()[0].getCanvases()[0];
          /* cf selectors/annotations/getPresentAnnotationsCanvas */
          const annotations = canvas.__jsonld.annotations.flatMap((a) => AnnotationFactory.determineAnnotation(a));
          wrapper = createWrapper({
            annotations,
            canvas,
          }, true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt" srcLang="en" />)).toBe(true);
          expect(wrapper.exists('video[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
        });
        it('multiples captions', () => {
          const canvas = Utils.parseManifest(videoMultiCaptions).getSequences()[0].getCanvases()[0];
          /* cf selectors/annotations/getPresentAnnotationsCanvas */
          const annotations = canvas.__jsonld.annotations.flatMap((a) => AnnotationFactory.determineAnnotation(a));
          wrapper = createWrapper({
            annotations,
            canvas,
          }, true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt#en" srcLang="en" />)).toBe(true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt#fr" srcLang="fr" />)).toBe(true);
          expect(wrapper.exists('video[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
        });
        it('multiples captions in multiples annotations', () => {
          const canvas = Utils.parseManifest(videoMultiCaptionsMultiAnno).getSequences()[0].getCanvases()[0];
          /* cf selectors/annotations/getPresentAnnotationsCanvas */
          const annotations = canvas.__jsonld.annotations.flatMap((a) => AnnotationFactory.determineAnnotation(a));
          wrapper = createWrapper({
            annotations,
            canvas,
          }, true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt#en" srcLang="en" />)).toBe(true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt#fr" srcLang="fr" />)).toBe(true);
          expect(wrapper.contains(<track src="https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt#ru" srcLang="ru" />)).toBe(true);
          expect(wrapper.exists('video[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
        });
      });
    });