Skip to content
Snippets Groups Projects
Select Git revision
  • f2ffa783fb88c55a48bffe75247f7051aac8a87a
  • main default protected
2 results

SSC-07-03.stog.amr.penman

Blame
  • canvas.test.js 1.41 KiB
    import * as actions from '../../../src/state/actions';
    import ActionTypes from '../../../src/state/actions/action-types';
    
    describe('canvas actions', () => {
      describe('nextCanvas', () => {
        it('moves to the next canvas', () => {
          const id = 'abc123';
          const expectedAction = {
            type: ActionTypes.NEXT_CANVAS,
            windowId: id,
          };
          expect(actions.nextCanvas(id)).toEqual(expectedAction);
        });
      });
      describe('previousCanvas', () => {
        it('moves to the previous canvas', () => {
          const id = 'abc123';
          const expectedAction = {
            type: ActionTypes.PREVIOUS_CANVAS,
            windowId: id,
          };
          expect(actions.previousCanvas(id)).toEqual(expectedAction);
        });
      });
      describe('setCanvas', () => {
        it('sets to a defined canvas', () => {
          const id = 'abc123';
          const expectedAction = {
            type: ActionTypes.SET_CANVAS,
            windowId: id,
            canvasIndex: 100,
          };
          expect(actions.setCanvas(id, 100)).toEqual(expectedAction);
        });
      });
      describe('updateViewport', () => {
        it('sets viewer state', () => {
          const id = 'abc123';
          const expectedAction = {
            type: ActionTypes.UPDATE_VIEWPORT,
            windowId: id,
            payload: {
              x: 1,
              y: 0,
              zoom: 0.5,
            },
          };
          expect(actions.updateViewport(id, { x: 1, y: 0, zoom: 0.5 })).toEqual(expectedAction);
        });
      });
    });