Sha256: a82da91f3ffdb46324108caeb5e31f71eb0c0e8401cd753794c83f1b959a85dc

Contents?: true

Size: 903 Bytes

Versions: 25

Compression:

Stored size: 903 Bytes

Contents

require("../env");
require("../../d3");
require("../../d3.layout");

var vows = require("vows"),
    assert = require("assert");

var suite = vows.describe("d3.layout.tree");

suite.addBatch({
  "tree": {
    topic: d3.layout.tree,
    "can handle an empty children array": function(tree) {
      assert.deepEqual(tree.nodes({children: []}).map(layout), [
        {depth: 0, x: 0.5, y: 0}
      ]);
      assert.deepEqual(tree.nodes({children: [
        {children: []},
        {children: [{}]},
        {children: [{}]}
      ]}).map(layout), [
        {depth: 0, x: .5,   y: 0},
        {depth: 1, x: .125, y: 0.5},
        {depth: 1, x: .375, y: 0.5},
        {depth: 2, x: .375, y: 1},
        {depth: 1, x: .875, y: 0.5},
        {depth: 2, x: .875, y: 1}
      ]);
    }
  }
});

function layout(node) {
  return {
    depth: node.depth,
    x: node.x,
    y: node.y
  };
}

suite.export(module);

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js