Skip to content
Snippets Groups Projects
Select Git revision
  • 424d107997852c39c5fd152aae03741fabb5b806
  • 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

CapsuleEditorController.php

Blame
  • annotations.test.js 2.28 KiB
    import { select } from 'redux-saga/effects';
    import { expectSaga } from 'redux-saga-test-plan';
    
    import { fetchAnnotations } from '../../../src/state/sagas/annotations';
    import { getAnnotations, getCanvases } from '../../../src/state/selectors';
    
    describe('annotation sagas', () => {
      describe('fetchAnnotations', () => {
        it('requests IIIF v2-style annotations for each visible canvas', () => {
          const action = {
            visibleCanvases: ['a', 'b'],
            windowId: 'foo',
          };
    
          return expectSaga(fetchAnnotations, action)
            .provide([
              [select(getCanvases, { windowId: 'foo' }), [
                { __jsonld: { otherContent: 'annoId' }, id: 'a' },
                { __jsonld: { otherContent: ['alreadyFetched'] }, id: 'b' },
              ]],
              [select(getAnnotations), { a: {}, b: { alreadyFetched: {} } }],
            ])
            .put({
              annotationId: 'annoId',
              targetId: 'a',
              type: 'mirador/REQUEST_ANNOTATION',
            })
            .run();
        });
        it('requests IIIF v3-style annotations for each visible canvas', () => {
          const action = {
            visibleCanvases: ['a', 'b'],
            windowId: 'foo',
          };
    
          return expectSaga(fetchAnnotations, action)
            .provide([
              [select(getCanvases, { windowId: 'foo' }), [
                { __jsonld: { annotations: { id: 'annoId', type: 'AnnotationPage' } }, id: 'a' },
              ]],
              [select(getAnnotations), { a: {} }],
            ])
            .put({
              annotationId: 'annoId',
              targetId: 'a',
              type: 'mirador/REQUEST_ANNOTATION',
            })
            .run();
        });
        it('handles embedded IIIF v3-style annotations on each visible canvas', () => {
          const action = {
            visibleCanvases: ['a', 'b'],
            windowId: 'foo',
          };
    
          const annotations = { id: 'annoId', items: [], type: 'AnnotationPage' };
    
          return expectSaga(fetchAnnotations, action)
            .provide([
              [select(getCanvases, { windowId: 'foo' }), [
                { __jsonld: { annotations }, id: 'a' },
              ]],
              [select(getAnnotations), { a: {} }],
            ])
            .put({
              annotationId: 'annoId',
              annotationJson: annotations,
              targetId: 'a',
              type: 'mirador/RECEIVE_ANNOTATION',
            })
            .run();
        });
      });
    });