Skip to content

Commit

Permalink
feat(test.Paper): be more specific about the called event
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKanera committed Nov 3, 2023
1 parent 17db65a commit e3c7951
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions test/jointjs/paper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2980,14 +2980,21 @@ QUnit.module('paper', function(hooks) {
graph.addCell(link);

const spy = sinon.spy();
paper.on(event, spy);
paper.on('all', spy);

const linkView = link.findView(paper);
const labelBody = linkView.el.querySelector('rect');

simulate.mousedown({ el: labelBody });

assert.equal(spy.callCount, 1);
assert.equal(spy.firstCall.args[0], linkView);
simulate.mousedown({ el: labelBody, clientX: 10, clientY: 10 });

var localPoint = paper.snapToGrid(10, 10);
assert.ok(spy.calledThrice);
assert.ok(spy.calledWithExactly(
event,
linkView,
sinon.match.instanceOf($.Event),
localPoint.x,
localPoint.y
));
});
});

0 comments on commit e3c7951

Please sign in to comment.