Skip to content
Snippets Groups Projects
Select Git revision
  • d241622b991cac8c071d47a50263f564e4402701
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

state.test.js

Blame
  • Display.test.js 1.23 KiB
    import React from 'react';
    import { shallow } from 'enzyme';
    import Display from '../../../src/components/Display';
    import ManifestMetadata from '../../../src/components/ManifestMetadata';
    import fixture from '../../fixtures/version-2/002.json';
    
    describe('Display', () => {
      it('renders without an error', () => {
        const wrapper = shallow(<Display manifest={{}} />);
        expect(wrapper.contains(<div className="Display"><div id="exampleManifest" className=""><ManifestMetadata manifest={{}} /></div></div>)).toBe(true);
      });
      it('sets class based on manifest state', () => {
        let wrapper = shallow(<Display manifest={{ isFetching: true }} />);
        expect(wrapper.find('.mirador-fetching').length).toBe(1);
    
        wrapper = shallow(<Display manifest={{ error: true }} />);
        expect(wrapper.find('.mirador-error').length).toBe(1);
      });
      it('displays content', () => {
        let wrapper = shallow(<Display manifest={{ isFetching: true }} />);
        expect(wrapper.text()).toBe('☕');
    
        wrapper = shallow(<Display manifest={{ error: { message: 'bad things' } }} />);
        expect(wrapper.text()).toBe('bad things');
    
        wrapper = shallow(<Display manifest={{ json: fixture }} />);
        expect(wrapper.find(ManifestMetadata).length).toBe(1);
      });
    });