Skip to content

Commit 51d4d0a

Browse files
committed
Add test for enter-insert.
1 parent d1f8082 commit 51d4d0a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/selection/insert-test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,28 @@ suite.addBatch({
110110
}
111111
});
112112

113+
suite.addBatch({
114+
"enter insert": {
115+
topic: load("selection/selection").document(),
116+
"on a page with existing elements": {
117+
topic: function(d3) {
118+
var body = d3.select("body");
119+
body.selectAll("div").data(["apple", "orange"]).enter().append("div");
120+
return body;
121+
},
122+
"inserts before the following updating sibling": function(body) {
123+
body.selectAll("div").data(["peach", "apple", "banana", "orange", "apricot"]).enter().insert("div");
124+
var div = body.selectAll("div");
125+
assert.equal(div[0][0].__data__, "peach");
126+
assert.equal(div[0][1].__data__, "apple");
127+
assert.equal(div[0][2].__data__, "banana");
128+
assert.equal(div[0][3].__data__, "orange");
129+
assert.equal(div[0][4].__data__, "apricot");
130+
}
131+
}
132+
}
133+
});
134+
113135
suite.addBatch({
114136
"selectAll(div).data(…).enter()": {
115137
topic: load("selection/selection").document(),

0 commit comments

Comments
 (0)