Skip to content
Snippets Groups Projects
Commit b2d7ae38 authored by Anthony's avatar Anthony
Browse files

WIP fixing test

parent 885df11b
No related branches found
No related tags found
No related merge requests found
...@@ -46,8 +46,8 @@ describe('CanvasAnnotations', () => { ...@@ -46,8 +46,8 @@ describe('CanvasAnnotations', () => {
expect(wrapper.find(Typography).length).toBe(1); expect(wrapper.find(Typography).length).toBe(1);
let heading = wrapper.find(Typography).props().children; let heading = wrapper.find(Typography).props().children;
expect(heading.key).toEqual('annotationCanvasLabel'); console.log(heading);
expect(heading.args.label).toEqual('A Canvas Label'); expect(heading.key).toEqual('showingNumAnnotations');
expect(heading.args.context).toEqual('1/1'); expect(heading.args.context).toEqual('1/1');
wrapper = createWrapper({ annotations, index: 1, totalSize: 2 }); wrapper = createWrapper({ annotations, index: 1, totalSize: 2 });
......
// eslint-disable-next-line import/no-extraneous-dependencies
const { setDefaultOptions } = require('expect-puppeteer'); const { setDefaultOptions } = require('expect-puppeteer');
setDefaultOptions({ timeout: 2000 }); setDefaultOptions({ timeout: 2000 });
import React, { Component } from 'react'; import { Component } from 'react';
import Accordion from '@material-ui/core/Accordion'; import Accordion from '@material-ui/core/Accordion';
import AccordionSummary from '@material-ui/core/AccordionSummary'; import AccordionSummary from '@material-ui/core/AccordionSummary';
import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp'; import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp';
...@@ -6,11 +6,10 @@ import Typography from '@material-ui/core/Typography'; ...@@ -6,11 +6,10 @@ import Typography from '@material-ui/core/Typography';
import AccordionDetails from '@material-ui/core/AccordionDetails'; import AccordionDetails from '@material-ui/core/AccordionDetails';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { import {
Card, CardActionArea, CardActions, CardContent, CardMedia, Fab, Card, CardActionArea, CardActions, CardContent,
} from '@material-ui/core'; } from '@material-ui/core';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip'; import Tooltip from '@material-ui/core/Tooltip';
import { removeDuplicates } from '../helper/utils';
/** /**
* AnnotationManifestsAccordion * AnnotationManifestsAccordion
...@@ -89,8 +88,6 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -89,8 +88,6 @@ export class AnnotationManifestsAccordion extends Component {
classes, t, i18n, classes, t, i18n,
} = this.props; } = this.props;
const language = i18n.language;
const { annotation } = this.state; const { annotation } = this.state;
if (annotation.manifests === null || annotation.manifests.length === 0) { if (annotation.manifests === null || annotation.manifests.length === 0) {
...@@ -104,17 +101,17 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -104,17 +101,17 @@ export class AnnotationManifestsAccordion extends Component {
expandIcon={<ExpandMoreIcon />} expandIcon={<ExpandMoreIcon />}
onClick={(e) => this.handleOpenAccordion(e)} onClick={(e) => this.handleOpenAccordion(e)}
> >
<Typography className={classes.heading}>{t('manifestFound')}</Typography> <Typography>{t('manifestFound')}</Typography>
</AccordionSummary> </AccordionSummary>
<AccordionDetails className={classes.manifestContainer}> <AccordionDetails className={classes.manifestContainer}>
{annotation.manifests.map(manifest => ( {annotation.manifests.map(manifest => (
<Typography> <Typography>
<Card className={classes.root}> <Card>
<CardActionArea> <CardActionArea>
<CardContent> <CardContent>
<Typography> <Typography>
{ manifest.label ? manifest.label[language] : manifest.id } { manifest.label ? manifest.label[i18n.language] : manifest.id }
</Typography> </Typography>
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>
...@@ -144,18 +141,23 @@ export class AnnotationManifestsAccordion extends Component { ...@@ -144,18 +141,23 @@ export class AnnotationManifestsAccordion extends Component {
AnnotationManifestsAccordion.propsTypes = { AnnotationManifestsAccordion.propsTypes = {
addResource: PropTypes.func.isRequired, addResource: PropTypes.func.isRequired,
addWindow: PropTypes.func.isRequired, addWindow: PropTypes.func.isRequired,
annotation: PropTypes.shape( annotation: PropTypes.shape({
{
content: PropTypes.string, content: PropTypes.string,
id: PropTypes.string, id: PropTypes.string,
manifests: PropTypes.arrayOf(PropTypes.string), manifests: PropTypes.shape({
}, id: PropTypes.string.isRequired,
), label: PropTypes.string.isRequired,
}),
}),
classes: PropTypes.objectOf(PropTypes.string), classes: PropTypes.objectOf(PropTypes.string),
i18n: PropTypes.shape({
language: PropTypes.string,
}),
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
AnnotationManifestsAccordion.defaultProps = { AnnotationManifestsAccordion.defaultProps = {
annotation: [],
classes: {}, classes: {},
htmlSanitizationRuleSet: 'iiif', htmlSanitizationRuleSet: 'iiif',
listContainerComponent: 'li', listContainerComponent: 'li',
......
...@@ -7,8 +7,6 @@ import MenuItem from '@material-ui/core/MenuItem'; ...@@ -7,8 +7,6 @@ import MenuItem from '@material-ui/core/MenuItem';
import ListItemText from '@material-ui/core/ListItemText'; import ListItemText from '@material-ui/core/ListItemText';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import SearchIcon from '@material-ui/icons/SearchSharp'; import SearchIcon from '@material-ui/icons/SearchSharp';
import InputBase from '@material-ui/core/InputBase';
import CircularProgress from '@material-ui/core/CircularProgress';
import TextField from '@material-ui/core/TextField'; import TextField from '@material-ui/core/TextField';
import SanitizedHtml from '../containers/SanitizedHtml'; import SanitizedHtml from '../containers/SanitizedHtml';
import { ScrollTo } from './ScrollTo'; import { ScrollTo } from './ScrollTo';
...@@ -73,7 +71,7 @@ export class CanvasAnnotations extends Component { ...@@ -73,7 +71,7 @@ export class CanvasAnnotations extends Component {
*/ */
render() { render() {
const { const {
autoScroll, classes, index, label, selectedAnnotationId, t, totalSize, autoScroll, classes, selectedAnnotationId, t,
listContainerComponent, htmlSanitizationRuleSet, hoveredAnnotationIds, listContainerComponent, htmlSanitizationRuleSet, hoveredAnnotationIds,
containerRef, containerRef,
} = this.props; } = this.props;
...@@ -84,7 +82,7 @@ export class CanvasAnnotations extends Component { ...@@ -84,7 +82,7 @@ export class CanvasAnnotations extends Component {
const { inputSearch } = this.state; const { inputSearch } = this.state;
if (inputSearch != undefined && inputSearch !== '') { if (inputSearch !== undefined && inputSearch !== '') {
annotations = filterAnnotation(annotations, inputSearch); annotations = filterAnnotation(annotations, inputSearch);
} }
...@@ -156,7 +154,7 @@ export class CanvasAnnotations extends Component { ...@@ -156,7 +154,7 @@ export class CanvasAnnotations extends Component {
</ScrollTo> </ScrollTo>
)) ))
} }
{annotations.length == 0 {annotations.length === 0
&& ( && (
<MenuItem> <MenuItem>
<Typography> <Typography>
...@@ -190,13 +188,10 @@ CanvasAnnotations.propTypes = { ...@@ -190,13 +188,10 @@ CanvasAnnotations.propTypes = {
hoverAnnotation: PropTypes.func.isRequired, hoverAnnotation: PropTypes.func.isRequired,
hoveredAnnotationIds: PropTypes.arrayOf(PropTypes.string), hoveredAnnotationIds: PropTypes.arrayOf(PropTypes.string),
htmlSanitizationRuleSet: PropTypes.string, htmlSanitizationRuleSet: PropTypes.string,
index: PropTypes.number.isRequired,
label: PropTypes.string.isRequired,
listContainerComponent: PropTypes.elementType, listContainerComponent: PropTypes.elementType,
selectAnnotation: PropTypes.func.isRequired, selectAnnotation: PropTypes.func.isRequired,
selectedAnnotationId: PropTypes.string, selectedAnnotationId: PropTypes.string,
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
totalSize: PropTypes.number.isRequired,
windowId: PropTypes.string.isRequired, windowId: PropTypes.string.isRequired,
}; };
CanvasAnnotations.defaultProps = { CanvasAnnotations.defaultProps = {
......
...@@ -21,7 +21,7 @@ export class WindowSideBarAnnotationsPanel extends Component { ...@@ -21,7 +21,7 @@ export class WindowSideBarAnnotationsPanel extends Component {
*/ */
render() { render() {
const { const {
annotationCount, classes, canvasIds, t, windowId, id, canvasIds, t, windowId, id,
} = this.props; } = this.props;
return ( return (
<CompanionWindow <CompanionWindow
...@@ -49,9 +49,7 @@ export class WindowSideBarAnnotationsPanel extends Component { ...@@ -49,9 +49,7 @@ export class WindowSideBarAnnotationsPanel extends Component {
} }
WindowSideBarAnnotationsPanel.propTypes = { WindowSideBarAnnotationsPanel.propTypes = {
annotationCount: PropTypes.number.isRequired,
canvasIds: PropTypes.arrayOf(PropTypes.string), canvasIds: PropTypes.arrayOf(PropTypes.string),
classes: PropTypes.objectOf(PropTypes.string).isRequired,
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
t: PropTypes.func, t: PropTypes.func,
windowId: PropTypes.string.isRequired, windowId: PropTypes.string.isRequired,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment