Skip to content

Commit 7019e13

Browse files
committed
update test - It doesn’t actually reset the svg on each render
1 parent b436131 commit 7019e13

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

test/render/index.spec.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import render from '../../src/render';
22
import mockViewport from '../mockViewport';
33
import { equal } from 'assert';
4+
import uuid from "../../src/utils/uuid"
45

56
function _render(annotations) {
67
let data = Array.isArray(annotations) ? { annotations } : annotations;
@@ -16,29 +17,40 @@ describe('render::index', function () {
1617
viewport = mockViewport();
1718
});
1819

19-
it('should reset SVG on each render', function () {
20+
it('should not render the same annotation multiple times', function () {
2021
let viewport = mockViewport(undefined, undefined, .5);
22+
let id1 = uuid();
23+
let id2 = uuid();
2124

2225
_render([
2326
{
24-
type: 'point',
27+
type: 'area',
2528
x: 0,
26-
y: 0
29+
y: 0,
30+
width: 10,
31+
height: 10,
32+
uuid: id1
2733
}
2834
]);
2935

3036
equal(svg.children.length, 1);
3137

3238
_render([
3339
{
34-
type: 'point',
40+
type: 'area',
3541
x: 0,
36-
y: 0
42+
y: 0,
43+
width: 10,
44+
height: 10,
45+
uuid: id1
3746
},
3847
{
39-
type: 'point',
48+
type: 'area',
4049
x: 25,
41-
y: 25
50+
y: 25,
51+
width: 10,
52+
height: 10,
53+
uuid: id2
4254
}
4355
]);
4456

0 commit comments

Comments
 (0)