~ubuntu-branches/ubuntu/precise/whoopsie-daisy/precise-proposed

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/test/core/xml-test.js

  • Committer: Package Import Robot
  • Author(s): Evan Dandrea
  • Date: 2012-04-10 14:28:58 UTC
  • Revision ID: package-import@ubuntu.com-20120410142858-nk453o1z7t7py3bs
Tags: 0.1.26
* Take ownership of the NetworkManager state variant on setup and
  unref it, plugging a memory leak.
* Log the reason the server rejected the submitted crash report.
* Send the Whoopsie version with each crash submission.
* Delete both .upload and .uploaded files after 14 days. Thanks
  Marc Deslauriers (LP: #973687).

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.xml");
 
7
 
 
8
suite.addBatch({
 
9
  "xml": {
 
10
    topic: function() {
 
11
      var cb = this.callback;
 
12
      return d3.xml("examples/data/sample.xml", function(xml) {
 
13
        cb(null, xml);
 
14
      });
 
15
    },
 
16
    "invokes the callback with the loaded xml": function(xml) {
 
17
      assert.deepEqual(xml, {_xml: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<hello>\n  <world name=\"Earth\"/>\n</hello>\n"});
 
18
    },
 
19
    "does not override the mime type by default": function(xml) {
 
20
      assert.isUndefined(XMLHttpRequest._last._info.mimeType);
 
21
    },
 
22
    "": {
 
23
      topic: function() {
 
24
        var cb = this.callback;
 
25
        return d3.xml("examples/data/sample.txt", "application/xml+sample", function(xml) {
 
26
          cb(null, xml);
 
27
        });
 
28
      },
 
29
      "observes the optional mime type": function(xml) {
 
30
        assert.equal(XMLHttpRequest._last._info.mimeType, "application/xml+sample");
 
31
      }
 
32
    },
 
33
    " ": {
 
34
      topic: function() {
 
35
        var cb = this.callback;
 
36
        return d3.xml("//does/not/exist.xml", function(xml) {
 
37
          cb(null, xml);
 
38
        });
 
39
      },
 
40
      "invokes the callback with null when an error occurs": function(xml) {
 
41
        assert.isNull(xml);
 
42
      }
 
43
    }
 
44
  }
 
45
});
 
46
 
 
47
suite.export(module);