Commit 99f6e657 authored by Mike Bostock's avatar Mike Bostock
Browse files

Fix test and add symmetric test for append.

parent 2f4c228b
......@@ -94,6 +94,24 @@ suite.addBatch({
}
});
suite.addBatch({
"enter-append": {
topic: load("selection/selection").document(),
"on a page with existing elements": {
topic: function(d3) {
var body = d3.select("body");
body.selectAll("div").data(["apple", "orange"]).enter().append("div");
return body;
},
"appends to the end of the parent": function(body) {
var data = ["peach", "apple", "banana", "orange", "apricot"];
body.selectAll("div").data(data, String).enter().append("div");
assert.deepEqual(body.selectAll("div").data(), ["apple", "orange", "peach", "banana", "apricot"]);
}
}
}
});
suite.addBatch({
"selectAll(div).data(…).enter()": {
topic: load("selection/selection").document(),
......
......@@ -111,7 +111,7 @@ suite.addBatch({
});
suite.addBatch({
"enter insert": {
"enter-insert": {
topic: load("selection/selection").document(),
"on a page with existing elements": {
topic: function(d3) {
......@@ -121,7 +121,7 @@ suite.addBatch({
},
"inserts before the following updating sibling": function(body) {
var data = ["peach", "apple", "banana", "orange", "apricot"];
body.selectAll("div").data(data).enter().insert("div");
body.selectAll("div").data(data, String).enter().insert("div");
assert.deepEqual(body.selectAll("div").data(), data);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment