Sha256: c3cc1213695200d3a1acdbf841dff4cdcc57b70845569252d0550f8b22ca4881

Contents?: true

Size: 915 Bytes

Versions: 4

Compression:

Stored size: 915 Bytes

Contents

var vows = require("vows"),
    load = require("../load"),
    assert = require("../assert");

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

suite.addBatch({
  "hierarchy": {
    topic: load("layout/treemap").expression("d3.layout.treemap"), // hierarchy is abstract, so test a subclass
    "doesn't overwrite the value of a node that has an empty children array": function(hierarchy) {
      var h = hierarchy(),
          nodes = h.sticky(true).nodes({value: 1, children: []});
      assert.equal(nodes[0].value, 1);
      h.nodes(nodes[0]);
      assert.equal(nodes[0].value, 1);
    },
    "a valueless node that has an empty children array gets a value of 0": function(hierarchy) {
      var h = hierarchy(),
          nodes = h.sticky(true).nodes({children: []});
      assert.equal(nodes[0].value, 0);
      h.nodes(nodes[0]);
      assert.equal(nodes[0].value, 0);
    }
  }
});

suite.export(module);

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
stripchart-0.0.3 lib/stripchart/public/components/d3/test/layout/hierarchy-test.js
stripmem-0.0.3 lib/stripmem/public/components/d3/test/layout/hierarchy-test.js
stripmem-0.0.2 lib/stripmem/public/components/d3/test/layout/hierarchy-test.js
stripmem-0.0.1 lib/stripmem/public/components/d3/test/layout/hierarchy-test.js