Skip to content

Commit

Permalink
transitions are iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil authored Jul 31, 2020
2 parents 91990a1 + 46027fa commit 2f6c57d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transition/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ Transition.prototype = transition.prototype = {
duration: transition_duration,
ease: transition_ease,
easeVarying: transition_easeVarying,
end: transition_end
end: transition_end,
[Symbol.iterator]: selection_prototype[Symbol.iterator]
};
8 changes: 8 additions & 0 deletions test/transition/size-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
var tape = require("tape"),
jsdom = require("../jsdom"),
d3_selection = require("d3-selection"),
d3_transition = require("../../");

tape("transition.size is the same as selection.size", function(test) {
test.equal(d3_transition.transition.prototype.size, d3_selection.selection.prototype.size);
test.end();
});

tape("transition.size() returns the expected value", function(test) {
var root = jsdom().documentElement;
test.equal(d3_selection.select(root).transition().size(), 1);
test.equal(d3_selection.selectAll([null, root]).transition().size(), 1);
test.end();
});

0 comments on commit 2f6c57d

Please sign in to comment.