Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datum passed to destroy should be most recent #81

Closed
curran opened this issue Mar 25, 2017 · 0 comments · Fixed by #82
Closed

Datum passed to destroy should be most recent #81

curran opened this issue Mar 25, 2017 · 0 comments · Fixed by #82

Comments

@curran
Copy link
Owner

curran commented Mar 25, 2017

This test fails if added to /test/exit-test.js.

var datum,
    customExit = d3.component("p")
      .destroy(function (selection, d){
        datum = d;
        return selection.transition().duration(10);
      });

tape("Datum passed to destroy should be most recent.", function(test) {
  var div = d3.select(jsdom.jsdom().body).append("div");

  div.call(customExit, "a");
  div.call(customExit, []);
  test.equal(datum, "a");

  div.call(customExit, "a");
  div.call(customExit, "b");
  div.call(customExit, []);
  test.equal(datum, "b"); // Fails here, uses "a"

  test.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant