~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/test/core/selection-node-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("selection.node");
7
 
 
8
 
suite.addBatch({
9
 
  "select(body)": {
10
 
    topic: function() {
11
 
      return d3.select("body").html("");
12
 
    },
13
 
    "returns null for empty selections": function(body) {
14
 
      assert.isNull(body.select("foo").node());
15
 
    },
16
 
    "returns the first element for non-empty selections": function(body) {
17
 
      assert.isTrue(body.node() === document.body);
18
 
    },
19
 
    "ignores null nodes": function(body) {
20
 
      var some = d3.select("body");
21
 
      some[0][0] = null;
22
 
      assert.isNull(some.node());
23
 
    }
24
 
  }
25
 
});
26
 
 
27
 
suite.addBatch({
28
 
  "selectAll(div)": {
29
 
    topic: function() {
30
 
      var body = d3.select("body").html("");
31
 
      body.append("div").append("span");
32
 
      body.append("div");
33
 
      return body.selectAll("div");
34
 
    },
35
 
    "returns null for empty selections": function(div) {
36
 
      assert.isNull(div.select("foo").node());
37
 
    },
38
 
    "returns the first element for non-empty selections": function(div) {
39
 
      assert.isTrue(div.node() === div[0][0]);
40
 
    },
41
 
    "ignores null nodes": function(div) {
42
 
      var some = d3.selectAll("div");
43
 
      some[0][0] = null;
44
 
      assert.isTrue(some.node() === div[0][1]);
45
 
    }
46
 
  }
47
 
});
48
 
 
49
 
suite.export(module);