3
var vows = require("vows"),
4
assert = require("assert");
6
var suite = vows.describe("d3.layout.cluster");
10
topic: d3.layout.cluster,
11
"can handle an empty children array": function(cluster) {
12
assert.deepEqual(cluster.nodes({value: 1, children: [{value: 1, children: []}, {value: 1}]}).map(layout), [
13
{value: 1, depth: 0, x: 0.5, y: 0},
14
{value: 1, depth: 1, x: 0.25, y: 1},
15
{value: 1, depth: 1, x: 0.75, y: 1}
18
"can handle zero-valued nodes": function(cluster) {
19
assert.deepEqual(cluster.nodes({value: 0, children: [{value: 0}, {value: 1}]}).map(layout), [
20
{value: 0, depth: 0, x: 0.5, y: 0},
21
{value: 0, depth: 1, x: 0.25, y: 1},
22
{value: 1, depth: 1, x: 0.75, y: 1}
25
"can handle a single node": function(cluster) {
26
assert.deepEqual(cluster.nodes({value: 0}).map(layout), [
27
{value: 0, depth: 0, x: 0.5, y: 0}
33
function layout(node) {