~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/test/layout/hierarchy-test.js

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require("../env");
2
 
 
3
 
var vows = require("vows"),
4
 
    assert = require("assert");
5
 
 
6
 
var suite = vows.describe("d3.layout.hierarchy");
7
 
 
8
 
suite.addBatch({
9
 
  "hierarchy": {
10
 
    topic: function() {
11
 
      return d3.layout.treemap(); // hierarchy is abstract, so test a subclass
12
 
    },
13
 
    "doesn't overwrite the value of a node that has an empty children array": function(hierarchy) {
14
 
      var nodes = hierarchy.sticky(true).nodes({value: 1, children: []});
15
 
      assert.equal(nodes[0].value, 1);
16
 
      hierarchy.nodes(nodes[0]);
17
 
      assert.equal(nodes[0].value, 1);
18
 
    },
19
 
    "a valueless node that has an empty children array gets a value of 0": function(hierarchy) {
20
 
      var nodes = hierarchy.sticky(true).nodes({children: []});
21
 
      assert.equal(nodes[0].value, 0);
22
 
      hierarchy.nodes(nodes[0]);
23
 
      assert.equal(nodes[0].value, 0);
24
 
    }
25
 
  }
26
 
});
27
 
 
28
 
suite.export(module);