Skip to content
Snippets Groups Projects
Unverified Commit c436e464 authored by aeschylus's avatar aeschylus Committed by GitHub
Browse files

Merge branch 'master' into add-overlapping-windowing-system

parents 71a21909 3dc9f99c
Branches
Tags
No related merge requests found
Showing
with 72 additions and 40 deletions
......@@ -8,6 +8,7 @@ describe('Basic end to end Mirador', () => {
});
it('loads a manifest and displays it', async () => {
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/sn904cj3439');
await expect(page).toClick('#fetchBtn');
await expect(page).toMatchElement('[data-manifestid="http://localhost:5000/api/sn904cj3439"] button');
......
......@@ -18,6 +18,9 @@
width: 800px;
height: 600px;
}
.mirador-app {
border: 2px solid black;
}
</style>
<title>Mirador</title>
</head>
......
......@@ -4,6 +4,7 @@ describe('Mirador Invalid API Response Handler Test', () => {
});
it('breaks Mirador', async () => {
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/invalid');
await expect(page).toClick('#fetchBtn');
await page.waitFor(1000);
......@@ -17,6 +18,7 @@ describe('Mirador Invalid API Response Handler Test', () => {
it('renders an error message when a manifest cannot be loaded (and allows it to be dismissed)', async () => {
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/broken');
await expect(page).toClick('#fetchBtn');
......
......@@ -4,6 +4,7 @@ describe('Mirador plugin use', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins.html');
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/sn904cj3439');
await expect(page).toClick('#fetchBtn');
......
......@@ -4,6 +4,7 @@ describe('Window actions', () => {
});
it('opens a window and closes it', async () => {
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/sn904cj3439');
await expect(page).toClick('#fetchBtn');
......
......@@ -5,6 +5,7 @@ describe('Window Sidebars', () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/');
await expect(page).toClick('#addBtn');
await expect(page).toClick('.mirador-add-resource-button');
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/001');
await expect(page).toClick('#fetchBtn');
......
import React from 'react';
import { shallow } from 'enzyme';
import { MuiThemeProvider } from '@material-ui/core/styles';
import Fullscreen from 'react-fullscreen-crossbrowser';
import Fullscreen from 'react-full-screen';
import WorkspaceControlPanel from '../../../src/containers/WorkspaceControlPanel';
import Workspace from '../../../src/containers/Workspace';
import WorkspaceAdd from '../../../src/containers/WorkspaceAdd';
......
......@@ -2,6 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import OpenSeadragon from 'openseadragon';
import { OpenSeadragonViewer } from '../../../src/components/OpenSeadragonViewer';
import ZoomControls from '../../../src/containers/ZoomControls';
jest.mock('openseadragon');
......@@ -30,6 +31,9 @@ describe('OpenSeadragonViewer', () => {
it('renders child components', () => {
expect(wrapper.find('.foo').length).toBe(1);
});
it('renders ZoomControls', () => {
expect(wrapper.find(ZoomControls).length).toBe(1);
});
describe('tileSourcesMatch', () => {
it('when they do not match', () => {
expect(wrapper.instance().tileSourcesMatch([])).toBe(false);
......
......@@ -2,7 +2,10 @@
"name": "mirador",
"version": "3.0.0-alpha.0",
"description": "",
"main": "index.js",
"main": "dist/mirador.min.js",
"files": [
"dist"
],
"scripts": {
"lint": "node_modules/.bin/eslint ./ && node_modules/.bin/sass-lint -v ./src/styles/**/*",
"server": "node_modules/.bin/http-server",
......@@ -46,7 +49,7 @@
"prop-types": "^15.6.2",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-fullscreen-crossbrowser": "^1.0.9",
"react-full-screen": "^0.2.4",
"react-i18next": "^10.2.0",
"react-mosaic-component": "^2.1.0",
"react-placeholder": "^3.0.1",
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import Fullscreen from 'react-fullscreen-crossbrowser';
import Fullscreen from 'react-full-screen';
import { I18nextProvider } from 'react-i18next';
import WorkspaceControlPanel from '../containers/WorkspaceControlPanel';
import Workspace from '../containers/Workspace';
......
......@@ -209,8 +209,8 @@ export class OpenSeadragonViewer extends Component {
ref={this.ref}
>
{ children }
</div>
<ZoomControls windowId={windowId} />
</div>
</>
);
}
......
......@@ -82,6 +82,7 @@ export class ThumbnailNavigation extends Component {
>
<CanvasThumbnail
imageUrl={manifestoCanvas.thumbnail(null, height)}
isValid={manifestoCanvas.hasValidDimensions}
maxHeight={config.thumbnailNavigation.height}
maxWidth={style.width}
aspectRatio={manifestoCanvas.aspectRatio}
......@@ -103,8 +104,8 @@ export class ThumbnailNavigation extends Component {
const { config, canvasGroupings } = this.props;
return canvasGroupings
.getCanvases(options.index)
.map(canvas => new ManifestoCanvas(canvas).aspectRatio)
.reduce((acc, current) => acc + Math.floor(config.thumbnailNavigation.height * current), 8);
.map(canvas => new ManifestoCanvas(canvas))
.reduce((acc, currentCanvas) => { return acc + (currentCanvas.hasValidDimensions ? Math.floor(config.thumbnailNavigation.height * currentCanvas.aspectRatio) : config.thumbnailNavigation.width); }, 8); // eslint-disable-line arrow-body-style, max-len
}
/**
......
......@@ -21,7 +21,6 @@ export class WindowSideBarCanvasPanel extends Component {
} = this.props;
const canvasesIdAndLabel = getIdAndLabelOfCanvases(canvases);
return (
<>
<Typography variant="h2" className={classes.windowSideBarH2}>{t('canvasIndex')}</Typography>
......
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import AddIcon from '@material-ui/icons/AddSharp';
import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp';
import AppBar from '@material-ui/core/AppBar';
......@@ -56,12 +57,21 @@ export class WorkspaceAdd extends React.Component {
<div className={ns('workspace-add')}>
{manifestList}
<Fab variant="extended" disabled={addResourcesOpen} className={classes.fab} color="secondary" onClick={() => (this.setAddResourcesVisibility(true))}>
<Fab
variant="extended"
disabled={addResourcesOpen}
className={classNames(classes.fab, ns('add-resource-button'))}
color="secondary"
onClick={() => (this.setAddResourcesVisibility(true))}
>
<AddIcon />
{t('addResource')}
</Fab>
<Drawer
className={classNames({
[classes.displayNone]: !addResourcesOpen,
})}
variant="persistent"
anchor="bottom"
open={addResourcesOpen}
......
......@@ -38,6 +38,7 @@ export default {
thumbnailNavigation: {
defaultPosition: 'bottom',
height: 150,
width: 100,
},
workspace: {
type: 'mosaic',
......
......@@ -39,6 +39,9 @@ const styles = theme => ({
bottom: theme.spacing.unit * 2,
right: theme.spacing.unit * 2,
},
displayNone: {
display: 'none',
},
typographyBody: {
flexGrow: 1,
fontSize: '1em',
......
......@@ -13,7 +13,6 @@ const styles = theme => ({
},
drawer: {
overflowX: 'hidden',
height: '100%',
},
});
......
......@@ -34,6 +34,8 @@ const styles = theme => ({
zoom_controls: {
position: 'absolute',
right: 0,
zIndex: 33,
top: 0,
},
ListItem: {
paddingTop: 0,
......
......@@ -39,6 +39,36 @@ export default class ManifestoCanvas {
}/info.json`;
}
/**
* checks whether the canvas has a valid height
*/
get hasValidHeight() {
return (
typeof this.canvas.getHeight() === 'number'
&& this.canvas.getHeight() > 0
);
}
/**
* checks whether the canvas has a valid height
*/
get hasValidWidth() {
return (
typeof this.canvas.getHeight() === 'number'
&& this.canvas.getHeight() > 0
);
}
/**
* checks whether the canvas has valid dimensions
*/
get hasValidDimensions() {
return (
this.hasValidHeight
&& this.hasValidWidth
);
}
/**
* Creates a canonical image request for a thumb
* @param {Number} height
......@@ -79,34 +109,4 @@ export default class ManifestoCanvas {
return desiredAspectRatio < aspectRatio ? 'sizeByW' : 'sizeByH';
}
/**
* checks whether the canvas has a valid height
*/
get hasValidHeight() {
return (
typeof this.canvas.getHeight() === 'number'
&& this.canvas.getHeight() > 0
);
}
/**
* checks whether the canvas has a valid height
*/
get hasValidWidth() {
return (
typeof this.canvas.getHeight() === 'number'
&& this.canvas.getHeight() > 0
);
}
/**
* checks whether the canvas has valid dimensions
*/
get hasValidDimensions() {
return (
this.hasValidHeight
&& this.hasValidWidth
);
}
}
......@@ -24,6 +24,7 @@
bottom: 0;
left: 0;
overflow: hidden;
margin: 0;
position: absolute;
right: 0;
top: 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment