Skip to content
Snippets Groups Projects
Commit a9b9b6d1 authored by David Beniamine's avatar David Beniamine
Browse files

Merge branch '3-upstream-01022023' into 'annotation-on-video'

Update from upstream

Closes #3

See merge request iiif/mirador-video-annotation!12
parents 53b90c72 26448c93
No related branches found
No related tags found
1 merge request!12Update from upstream
Pipeline #1341 passed
Showing
with 26 additions and 43 deletions
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { Rnd } from 'react-rnd'; import { Rnd } from 'react-rnd';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton'; import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WindowSideBarInfoPanel from '../../../src/containers/WindowSideBarInfoPanel'; import WindowSideBarInfoPanel from '../../../src/containers/WindowSideBarInfoPanel';
import WindowSideBarCanvasPanel from '../../../src/containers/WindowSideBarCanvasPanel'; import WindowSideBarCanvasPanel from '../../../src/containers/WindowSideBarCanvasPanel';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import FullscreenIcon from '@material-ui/icons/FullscreenSharp'; import FullscreenIcon from '@material-ui/icons/FullscreenSharp';
import FullscreenExitIcon from '@material-ui/icons/FullscreenExitSharp'; import FullscreenExitIcon from '@material-ui/icons/FullscreenExitSharp';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton'; import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
import { FullScreenButton } from '../../../src/components/FullScreenButton'; import { FullScreenButton } from '../../../src/components/FullScreenButton';
import FullScreenContext from '../../../src/contexts/FullScreenContext';
/** */ /** */
function createWrapper(props) { function createWrapper(props, contextProps = { active: false }) {
return shallow( return shallow(
<FullScreenButton <FullScreenButton
classes={{}} classes={{}}
className="xyz" className="xyz"
setWorkspaceFullscreen={() => {}}
isFullscreenEnabled={false}
{...props} {...props}
/>, />,
); {
wrappingComponent: FullScreenContext.Provider,
wrappingComponentProps: { value: { enter: () => { }, exit: () => { }, ...contextProps } },
},
).dive();
} }
describe('FullScreenButton', () => { describe('FullScreenButton', () => {
...@@ -30,10 +32,10 @@ describe('FullScreenButton', () => { ...@@ -30,10 +32,10 @@ describe('FullScreenButton', () => {
}); });
describe('when not in fullscreen', () => { describe('when not in fullscreen', () => {
let setWorkspaceFullscreen; let enter;
beforeAll(() => { beforeAll(() => {
setWorkspaceFullscreen = jest.fn(); enter = jest.fn();
wrapper = createWrapper({ setWorkspaceFullscreen }); wrapper = createWrapper({}, { enter });
menuButton = wrapper.find(MiradorMenuButton); menuButton = wrapper.find(MiradorMenuButton);
}); });
...@@ -45,17 +47,17 @@ describe('FullScreenButton', () => { ...@@ -45,17 +47,17 @@ describe('FullScreenButton', () => {
expect(menuButton.props()['aria-label']).toEqual('workspaceFullScreen'); expect(menuButton.props()['aria-label']).toEqual('workspaceFullScreen');
}); });
it('triggers the setWorkspaceFullscreen prop with the appropriate boolean', () => { it('triggers the handle enter with the appropriate boolean', () => {
menuButton.props().onClick(); // Trigger the onClick prop menuButton.props().onClick(); // Trigger the onClick prop
expect(setWorkspaceFullscreen).toHaveBeenCalledWith(true); expect(enter).toHaveBeenCalled();
}); });
}); });
describe('when in fullscreen', () => { describe('when in fullscreen', () => {
let setWorkspaceFullscreen; let exit;
beforeAll(() => { beforeAll(() => {
setWorkspaceFullscreen = jest.fn(); exit = jest.fn();
wrapper = createWrapper({ isFullscreenEnabled: true, setWorkspaceFullscreen }); wrapper = createWrapper({}, { active: true, exit });
menuButton = wrapper.find(MiradorMenuButton); menuButton = wrapper.find(MiradorMenuButton);
}); });
...@@ -67,9 +69,9 @@ describe('FullScreenButton', () => { ...@@ -67,9 +69,9 @@ describe('FullScreenButton', () => {
expect(menuButton.props()['aria-label']).toEqual('exitFullScreen'); expect(menuButton.props()['aria-label']).toEqual('exitFullScreen');
}); });
it('triggers the setWorkspaceFullscreen prop with the appropriate boolean', () => { it('triggers the handle exit with the appropriate boolean', () => {
menuButton.props().onClick(); // Trigger the onClick prop menuButton.props().onClick(); // Trigger the onClick prop
expect(setWorkspaceFullscreen).toHaveBeenCalledWith(false); expect(exit).toHaveBeenCalled();
}); });
}); });
}); });
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { Utils } from 'manifesto.js'; import { Utils } from 'manifesto.js';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { Utils } from 'manifesto.js'; import { Utils } from 'manifesto.js';
import Chip from '@material-ui/core/Chip'; import Chip from '@material-ui/core/Chip';
import IntersectionObserver from '@researchgate/react-intersection-observer'; import { InView } from 'react-intersection-observer';
import manifestJson from '../../fixtures/version-2/019.json'; import manifestJson from '../../fixtures/version-2/019.json';
import { GalleryViewThumbnail } from '../../../src/components/GalleryViewThumbnail'; import { GalleryViewThumbnail } from '../../../src/components/GalleryViewThumbnail';
import IIIFThumbnail from '../../../src/containers/IIIFThumbnail'; import IIIFThumbnail from '../../../src/containers/IIIFThumbnail';
...@@ -78,7 +77,7 @@ describe('GalleryView', () => { ...@@ -78,7 +77,7 @@ describe('GalleryView', () => {
}; };
wrapper = createWrapper({ annotationsCount: 0, canvas, requestCanvasAnnotations }); wrapper = createWrapper({ annotationsCount: 0, canvas, requestCanvasAnnotations });
wrapper.find(IntersectionObserver).simulate('change', { isIntersecting: true }); wrapper.find(InView).simulate('change', { isIntersecting: true });
expect(requestCanvasAnnotations).toHaveBeenCalled(); expect(requestCanvasAnnotations).toHaveBeenCalled();
}); });
it('does nothing if there is no intersection', () => { it('does nothing if there is no intersection', () => {
...@@ -89,7 +88,7 @@ describe('GalleryView', () => { ...@@ -89,7 +88,7 @@ describe('GalleryView', () => {
}; };
wrapper = createWrapper({ canvas, requestCanvasAnnotations }); wrapper = createWrapper({ canvas, requestCanvasAnnotations });
wrapper.find(IntersectionObserver).simulate('change', { isIntersecting: false }); wrapper.find(InView).simulate('change', { isIntersecting: false });
expect(requestCanvasAnnotations).not.toHaveBeenCalled(); expect(requestCanvasAnnotations).not.toHaveBeenCalled();
}); });
it('does nothing if there are already some annotations', () => { it('does nothing if there are already some annotations', () => {
...@@ -100,7 +99,7 @@ describe('GalleryView', () => { ...@@ -100,7 +99,7 @@ describe('GalleryView', () => {
}; };
wrapper = createWrapper({ annotationsCount: 5, canvas, requestCanvasAnnotations }); wrapper = createWrapper({ annotationsCount: 5, canvas, requestCanvasAnnotations });
wrapper.find(IntersectionObserver).simulate('change', { isIntersecting: true }); wrapper.find(InView).simulate('change', { isIntersecting: true });
expect(requestCanvasAnnotations).not.toHaveBeenCalled(); expect(requestCanvasAnnotations).not.toHaveBeenCalled();
}); });
}); });
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WindowAuthenticationBar from '../../../src/containers/WindowAuthenticationBar'; import WindowAuthenticationBar from '../../../src/containers/WindowAuthenticationBar';
import { NewWindow } from '../../../src/components/NewWindow'; import { NewWindow } from '../../../src/components/NewWindow';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import IntersectionObserver from '@researchgate/react-intersection-observer'; import { InView } from 'react-intersection-observer';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import { IIIFThumbnail } from '../../../src/components/IIIFThumbnail'; import { IIIFThumbnail } from '../../../src/components/IIIFThumbnail';
...@@ -26,9 +25,9 @@ describe('IIIFThumbnail', () => { ...@@ -26,9 +25,9 @@ describe('IIIFThumbnail', () => {
it('renders properly', () => { it('renders properly', () => {
expect(wrapper.matchesElement( expect(wrapper.matchesElement(
<div> <div>
<IntersectionObserver onChange={wrapper.instance().handleIntersection}> <InView onChange={wrapper.instance().handleIntersection}>
<img alt="" /> <img alt="" />
</IntersectionObserver> </InView>
</div>, </div>,
)).toBe(true); )).toBe(true);
}); });
...@@ -37,9 +36,9 @@ describe('IIIFThumbnail', () => { ...@@ -37,9 +36,9 @@ describe('IIIFThumbnail', () => {
wrapper = createWrapper({}); wrapper = createWrapper({});
expect(wrapper.matchesElement( expect(wrapper.matchesElement(
<div> <div>
<IntersectionObserver onChange={wrapper.instance().handleIntersection}> <InView onChange={wrapper.instance().handleIntersection}>
<img alt="" /> <img alt="" />
</IntersectionObserver> </InView>
</div>, </div>,
)).toBe(true); )).toBe(true);
expect(wrapper.find('img').props().src).toMatch(/data:image\/png;base64/); expect(wrapper.find('img').props().src).toMatch(/data:image\/png;base64/);
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import { LabelValueMetadata } from '../../../src/components/LabelValueMetadata'; import { LabelValueMetadata } from '../../../src/components/LabelValueMetadata';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import ListItemText from '@material-ui/core/ListItemText'; import ListItemText from '@material-ui/core/ListItemText';
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import CanvasLayers from '../../../src/containers/CanvasLayers'; import CanvasLayers from '../../../src/containers/CanvasLayers';
import { LayersPanel } from '../../../src/components/LayersPanel'; import { LayersPanel } from '../../../src/components/LayersPanel';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select'; import Select from '@material-ui/core/Select';
......
import React from 'react';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { ManifestForm } from '../../../src/components/ManifestForm'; import { ManifestForm } from '../../../src/components/ManifestForm';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import { ManifestInfo } from '../../../src/components/ManifestInfo'; import { ManifestInfo } from '../../../src/components/ManifestInfo';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import ButtonBase from '@material-ui/core/ButtonBase'; import ButtonBase from '@material-ui/core/ButtonBase';
import ListItem from '@material-ui/core/ListItem'; import ListItem from '@material-ui/core/ListItem';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link'; import Link from '@material-ui/core/Link';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Badge from '@material-ui/core/Badge'; import Badge from '@material-ui/core/Badge';
import IconButton from '@material-ui/core/IconButton'; import IconButton from '@material-ui/core/IconButton';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import MinimalWindow from '../../../src/containers/MinimalWindow'; import MinimalWindow from '../../../src/containers/MinimalWindow';
import { MosaicRenderPreview } from '../../../src/components/MosaicRenderPreview'; import { MosaicRenderPreview } from '../../../src/components/MosaicRenderPreview';
......
import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText'; import ListItemText from '@material-ui/core/ListItemText';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment