Sha256: 8b265fb7efd1fb39d079bff4408859eccd567c033bf8b014c5bd81ad0f05e9e8

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

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

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

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

suite.addBatch({
  "partition": {
    topic: function() {
      return d3.layout.partition;
    },
    "ignores zero values": function(partition) {
      var p = partition().size([3, 3]);
      assert.deepEqual(p({children: [{value: 1}, {value: 0}, {value: 2}, {children: [{value: 0}, {value: 0}]}]}).map(metadata), [
        {x: 0, y: 0, dx: 3, dy: 1},
        {x: 2, y: 1, dx: 1, dy: 1},
        {x: 3, y: 1, dx: 0, dy: 1},
        {x: 0, y: 1, dx: 2, dy: 1},
        {x: 3, y: 1, dx: 0, dy: 1},
        {x: 3, y: 2, dx: 0, dy: 1},
        {x: 3, y: 2, dx: 0, dy: 1}
      ]);
    }
  }
});

function metadata(node) {
  var metadata = {};
  if ("x" in node) metadata.x = node.x;
  if ("y" in node) metadata.y = node.y;
  if ("dx" in node) metadata.dx = node.dx;
  if ("dy" in node) metadata.dy = node.dy;
  return metadata;
}

suite.export(module);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bum-0.0.17 public/d3/test/layout/partition-test.js
bum-0.0.16 public/d3/test/layout/partition-test.js
bum-0.0.15 public/d3/test/layout/partition-test.js
bum-0.0.14 public/d3/test/layout/partition-test.js
bum-0.0.13 public/d3/test/layout/partition-test.js
bum-0.0.12 public/d3/test/layout/partition-test.js