Skip to content

Commit

Permalink
skip: Apply changed event firing
Browse files Browse the repository at this point in the history
Ref #121
  • Loading branch information
netil committed Aug 23, 2017
1 parent f7cae57 commit 96cfe6e
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions spec/selection-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@ describe("SELECTION", () => {
let circle = d3.select(`.${CLASS.shape}-3`).node().getBBox();
let rect = d3.select(`.${CLASS.eventRect}-3`).node();

util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

expect(spySelected.calledOnce).to.be.true;

circle = d3.select(`.${CLASS.shape}-4`).node().getBBox();
rect = d3.select(`.${CLASS.eventRect}-4`).node();

util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

expect(spySelected.calledTwice).to.be.true;

// should be selected multiple data points
Expand All @@ -63,13 +71,21 @@ describe("SELECTION", () => {
let circle = d3.select(`.${CLASS.shape}-3`).node().getBBox();
let rect = d3.select(`.${CLASS.eventRect}-3`).node();

util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

expect(spySelected.calledOnce).to.be.true;

circle = d3.select(`.${CLASS.shape}-4`).node().getBBox();
rect = d3.select(`.${CLASS.eventRect}-4`).node();

util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

expect(spySelected.calledTwice).to.be.true;
expect(spyUnSelected.calledOnce).to.be.true;

Expand All @@ -81,8 +97,15 @@ describe("SELECTION", () => {
const circle = d3.select(`.${CLASS.shape}-3`).node().getBBox();
const rect = d3.select(`.${CLASS.eventRect}-3`).node();

util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.setMouseEvent(chart, "click", circle.x, circle.y, rect);
util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

util.fireEvent(rect, "click", {
clientX: circle.x,
clientY: circle.y
}, chart);

expect(spySelected.calledOnce).to.be.true;
expect(spyUnSelected.calledOnce).to.be.true;
Expand Down

0 comments on commit 96cfe6e

Please sign in to comment.