Skip to content
Snippets Groups Projects
Select Git revision
  • 54b4fa20e0dc879c12c6aa6109c0127122249f07
  • mui5-annotation-on-video-stable default
  • get_setter_canvasSizeInformations
  • fix-error-div-into-p
  • annotation-on-video-v2
  • detached
  • annotation-on-video-r17
  • mui5
  • mui5-react-18
  • jacob-test
  • annotation-on-video protected
  • master
  • test-antoinev1
  • 20-fetch-thumbnail-on-annotation
  • add-research-field
  • Save
  • add-plugin
  • 14-wip-no-seek-to
  • 14-bug-on-video-time-control
  • 9_wip_videotests
  • _upgrade_material_ui
  • latest-tetras-16
  • v3.3.0
  • v3.2.0
  • v3.1.1
  • v3.1.0
  • v3.0.0
  • v3.0.0-rc.7
  • v3.0.0-rc.6
  • v3.0.0-rc.5
  • v3.0.0-rc.4
  • v3.0.0-rc.3
  • v3.0.0-rc.2
  • v3.0.0-rc.1
  • v3.0.0-beta.10
  • v3.0.0-beta.9
  • v3.0.0-beta.8
  • v3.0.0-beta.7
  • v3.0.0-beta.6
  • v3.0.0-beta.5
  • v3.0.0-beta.3
41 results

AudioViewer.test.js

Blame
  • user avatar
    Chris Beer authored
    54b4fa20
    History
    AudioViewer.test.js 1.61 KiB
    import { shallow } from 'enzyme';
    import { AudioViewer } from '../../../src/components/AudioViewer';
    
    /** create wrapper */
    function createWrapper(props, suspenseFallback) {
      return shallow(
        <AudioViewer
          classes={{}}
          audioOptions={{ crossOrigin: 'anonymous' }}
          {...props}
        />,
      );
    }
    
    describe('AudioViewer', () => {
      let wrapper;
      describe('render', () => {
        it('audioResources', () => {
          wrapper = createWrapper({
            audioResources: [
              { getFormat: () => 'video/mp4', id: 1 },
              { getFormat: () => 'video/mp4', id: 2 },
            ],
          }, true);
          expect(wrapper.contains(<source src={1} type="video/mp4" />)).toBe(true);
          expect(wrapper.contains(<source src={2} type="video/mp4" />)).toBe(true);
        });
        it('passes through configurable options', () => {
          wrapper = createWrapper({
            audioResources: [
              { getFormat: () => 'audio/mp3', id: 1 },
            ],
          }, true);
          expect(wrapper.exists('audio[crossOrigin="anonymous"]')).toBe(true); // eslint-disable-line jsx-a11y/media-has-caption
        });
        it('captions', () => {
          wrapper = createWrapper({
            audioResources: [
              { getFormat: () => 'video/mp4', id: 1 },
            ],
            captions: [
              { getDefaultLabel: () => 'English', getProperty: () => 'en', id: 1 },
              { getDefaultLabel: () => 'French', getProperty: () => 'fr', id: 2 },
            ],
          }, 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);
        });
      });
    });