Skip to content

Commit

Permalink
Add empty children test for treemap layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasondavies committed Sep 8, 2011
1 parent feef31a commit 1873142
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/layout/treemap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ suite.addBatch({
{"value": 1189}
]}).map(layout);
assert.equal(nodes.filter(function(n) { return n.dx < 0 || n.dy < 0; }).length, 0);
},
"can handle an empty children array": function(treemap) {
assert.deepEqual(treemap().nodes({children: []}).map(layout), [
{x: 0, y: 0, dx: 1, dy: 1}
]);
assert.deepEqual(treemap().nodes({children: [{children: []}, {value: 1}]}).map(layout), [
{x: 0, y: 0, dx: 1, dy: 1},
{x: 0, y: 0, dx: 0, dy: 1},
{x: 0, y: 0, dx: 1, dy: 1}
]);
}
}
});
Expand Down

0 comments on commit 1873142

Please sign in to comment.