Skip to content
Snippets Groups Projects
Commit 9ea14006 authored by Lutz Helm's avatar Lutz Helm
Browse files

Fix #3401 - expect annotations without target selector

parent 5ca33205
Branches
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ describe('CanvasAnnotationDisplay', () => { ...@@ -34,7 +34,7 @@ describe('CanvasAnnotationDisplay', () => {
expect(subject.svgContext).toHaveBeenCalled(); expect(subject.svgContext).toHaveBeenCalled();
expect(subject.fragmentContext).not.toHaveBeenCalled(); expect(subject.fragmentContext).not.toHaveBeenCalled();
}); });
it('selects fragmentSelector if no svg present', () => { it('selects fragmentSelector if present and if no svg is present', () => {
const context = { const context = {
stroke: jest.fn(), stroke: jest.fn(),
}; };
...@@ -47,6 +47,19 @@ describe('CanvasAnnotationDisplay', () => { ...@@ -47,6 +47,19 @@ describe('CanvasAnnotationDisplay', () => {
expect(subject.svgContext).not.toHaveBeenCalled(); expect(subject.svgContext).not.toHaveBeenCalled();
expect(subject.fragmentContext).toHaveBeenCalled(); expect(subject.fragmentContext).toHaveBeenCalled();
}); });
it('ignores annotations without selectors', () => {
const context = {
stroke: jest.fn(),
};
const subject = createSubject({
resource: new AnnotationResource({ on: 'www.example.com' }),
});
subject.svgContext = jest.fn();
subject.fragmentContext = jest.fn();
subject.toContext(context);
expect(subject.svgContext).not.toHaveBeenCalled();
expect(subject.fragmentContext).not.toHaveBeenCalled();
});
}); });
describe('svgString', () => { describe('svgString', () => {
it('selects the svg selector string value', () => { it('selects the svg selector string value', () => {
......
...@@ -20,7 +20,7 @@ export default class CanvasAnnotationDisplay { ...@@ -20,7 +20,7 @@ export default class CanvasAnnotationDisplay {
this.context = context; this.context = context;
if (this.resource.svgSelector) { if (this.resource.svgSelector) {
this.svgContext(); this.svgContext();
} else { } else if (this.resource.fragmentSelector) {
this.fragmentContext(); this.fragmentContext();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment