Skip to content

Commit 99f6e65

Browse files
committed
Fix test and add symmetric test for append.
1 parent 2f4c228 commit 99f6e65

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

test/selection/append-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,24 @@ suite.addBatch({
9494
}
9595
});
9696

97+
suite.addBatch({
98+
"enter-append": {
99+
topic: load("selection/selection").document(),
100+
"on a page with existing elements": {
101+
topic: function(d3) {
102+
var body = d3.select("body");
103+
body.selectAll("div").data(["apple", "orange"]).enter().append("div");
104+
return body;
105+
},
106+
"appends to the end of the parent": function(body) {
107+
var data = ["peach", "apple", "banana", "orange", "apricot"];
108+
body.selectAll("div").data(data, String).enter().append("div");
109+
assert.deepEqual(body.selectAll("div").data(), ["apple", "orange", "peach", "banana", "apricot"]);
110+
}
111+
}
112+
}
113+
});
114+
97115
suite.addBatch({
98116
"selectAll(div).data(…).enter()": {
99117
topic: load("selection/selection").document(),

test/selection/insert-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ suite.addBatch({
111111
});
112112

113113
suite.addBatch({
114-
"enter insert": {
114+
"enter-insert": {
115115
topic: load("selection/selection").document(),
116116
"on a page with existing elements": {
117117
topic: function(d3) {
@@ -121,7 +121,7 @@ suite.addBatch({
121121
},
122122
"inserts before the following updating sibling": function(body) {
123123
var data = ["peach", "apple", "banana", "orange", "apricot"];
124-
body.selectAll("div").data(data).enter().insert("div");
124+
body.selectAll("div").data(data, String).enter().insert("div");
125125
assert.deepEqual(body.selectAll("div").data(), data);
126126
}
127127
}

0 commit comments

Comments
 (0)