From 424499ba57932c35be89bb3efe3d66ae7bbffa13 Mon Sep 17 00:00:00 2001 From: Lutz Helm Date: Wed, 1 Nov 2023 16:39:51 +0100 Subject: [PATCH] Make OSD viewer test compatible with OSD 2.4.2 Tests would previously fail if OSD version 2.4.2 was installed. See https://github.com/ProjectMirador/mirador/discussions/3792 --- __tests__/src/components/OpenSeadragonViewer.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/src/components/OpenSeadragonViewer.test.js b/__tests__/src/components/OpenSeadragonViewer.test.js index 480f41c16..464c1d4aa 100644 --- a/__tests__/src/components/OpenSeadragonViewer.test.js +++ b/__tests__/src/components/OpenSeadragonViewer.test.js @@ -2,11 +2,11 @@ import { cloneElement } from 'react'; import { render, screen, waitFor } from 'test-utils'; import PropTypes from 'prop-types'; import userEvent from '@testing-library/user-event'; -import OpenSeadragon from 'openseadragon'; import { Utils } from 'manifesto.js'; import { OpenSeadragonViewer } from '../../../src/components/OpenSeadragonViewer'; import CanvasWorld from '../../../src/lib/CanvasWorld'; import fixture from '../../fixtures/version-2/019.json'; +import { OSDReferences } from '../../../src/plugins/OSDReferences'; const canvases = Utils.parseManifest(fixture).getSequences()[0].getCanvases(); @@ -56,7 +56,7 @@ function createWrapper(props) { const rendered = render(component); - const viewer = OpenSeadragon.getViewer(screen.getByLabelText('item')); + const viewer = OSDReferences.get('base').current; return { ...rendered, component, viewer }; }