Skip to content
Snippets Groups Projects
Commit fedaefb4 authored by imranasghar96@hotmail.com's avatar imranasghar96@hotmail.com
Browse files

Update tests

parent f8f957b0
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,9 @@ import WebAnnotation from '../src/WebAnnotation';
/** */
function createSubject(args = {}) {
return new WebAnnotation({
body: 'body',
body: {
value: 'body',
},
canvasId: 'canvasId',
id: 'id',
svg: 'svg',
......@@ -17,10 +19,15 @@ describe('WebAnnotation', () => {
let subject = createSubject();
describe('constructor', () => {
it('sets instance accessors', () => {
['body', 'canvasId', 'id', 'svg', 'xywh'].forEach((prop) => {
['canvasId', 'id', 'svg', 'xywh'].forEach((prop) => {
expect(subject[prop]).toBe(prop);
});
});
it('sets instance accessors for body', () => {
['body'].forEach((prop) => {
expect(subject[prop].value).toBe(prop);
});
});
});
describe('target', () => {
it('with svg and xywh', () => {
......
......@@ -86,6 +86,7 @@ class AnnotationCreation extends Component {
annoState.image = props.annotation.body.image;
}
if (props.annotation.target.selector) {
if (Array.isArray(props.annotation.target.selector)) {
props.annotation.target.selector.forEach((selector) => {
if (selector.type === 'SvgSelector') {
......@@ -98,6 +99,7 @@ class AnnotationCreation extends Component {
annoState.svg = props.annotation.target.selector.value;
}
}
}
this.state = {
activeTool: 'cursor',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment