diff --git a/__tests__/src/components/GalleryViewThumbnail.test.js b/__tests__/src/components/GalleryViewThumbnail.test.js index f2d0bab54170c4f911def67e2916a62d2c8e8ee8..1dd5fb80bcc0f34d5219ded175bd5c985a983f0f 100644 --- a/__tests__/src/components/GalleryViewThumbnail.test.js +++ b/__tests__/src/components/GalleryViewThumbnail.test.js @@ -62,6 +62,13 @@ describe('GalleryView', () => { expect(focusOnCanvas).toHaveBeenCalled(); }); + it('sets the canvas if the user hits a key (non-space or non-enter) while on a canvas', () => { + const setCanvas = jest.fn(); + wrapper = createWrapper({ selected: true, setCanvas }); + wrapper.find('div[role="button"]').first().simulate('keyUp', { key: 'd' }); + expect(setCanvas).toHaveBeenCalledWith('http://iiif.io/api/presentation/2.0/example/fixtures/canvas/24/c1.json'); + }); + describe('on-demand annotation fetching', () => { it('fetches annotations', () => { const requestCanvasAnnotations = jest.fn(); diff --git a/src/components/GalleryViewThumbnail.js b/src/components/GalleryViewThumbnail.js index 1998aecd75c2063fae00ac393e277cca011a49a6..80ae8e1277e13296f66c1a2e379b00c736000ef3 100644 --- a/src/components/GalleryViewThumbnail.js +++ b/src/components/GalleryViewThumbnail.js @@ -65,7 +65,7 @@ export class GalleryViewThumbnail extends Component { if (enterOrSpace) { focusOnCanvas(); } else { - setCanvas(canvas.index, canvas.id); + setCanvas(canvas.id); } }