Commit a27d2d36 authored by Mike Bostock's avatar Mike Bostock
Browse files

Test for append(function).

parent bef1ccb9
...@@ -25,6 +25,12 @@ suite.addBatch({ ...@@ -25,6 +25,12 @@ suite.addBatch({
assert.isTrue(svg[0][0].parentNode === body.node()); assert.isTrue(svg[0][0].parentNode === body.node());
assert.isTrue(svg[0][0] === body.node().lastChild); assert.isTrue(svg[0][0] === body.node().lastChild);
}, },
"appends an element specified as a function": function(body) {
var svg = body.select("svg").remove().node();
assert.isFalse(svg === body.node().lastChild);
body.append(function() { return svg; });
assert.isTrue(svg === body.node().lastChild);
},
"propagates data to new element": function(body) { "propagates data to new element": function(body) {
var data = new Object(), div = body.data([data]).append("div"); var data = new Object(), div = body.data([data]).append("div");
assert.strictEqual(div[0][0].__data__, data); assert.strictEqual(div[0][0].__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