Sha256: 6d563656f07b128b9979e7bdcab75050c3c8e9a5554b8e6bf502a25cd1ae6aa3

Contents?: true

Size: 1.32 KB

Versions: 31

Compression:

Stored size: 1.32 KB

Contents

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

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

var suite = vows.describe("d3.xml");

suite.addBatch({
  "xml": {
    topic: function() {
      var cb = this.callback;
      return d3.xml("examples/data/sample.xml", function(xml) {
        cb(null, xml);
      });
    },
    "invokes the callback with the loaded xml": function(xml) {
      assert.deepEqual(xml, {_xml: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<hello>\n  <world name=\"Earth\"/>\n</hello>\n"});
    },
    "does not override the mime type by default": function(xml) {
      assert.isUndefined(XMLHttpRequest._last._info.mimeType);
    },
    "": {
      topic: function() {
        var cb = this.callback;
        return d3.xml("examples/data/sample.txt", "application/xml+sample", function(xml) {
          cb(null, xml);
        });
      },
      "observes the optional mime type": function(xml) {
        assert.equal(XMLHttpRequest._last._info.mimeType, "application/xml+sample");
      }
    },
    " ": {
      topic: function() {
        var cb = this.callback;
        return d3.xml("//does/not/exist.xml", function(xml) {
          cb(null, xml);
        });
      },
      "invokes the callback with null when an error occurs": function(xml) {
        assert.isNull(xml);
      }
    }
  }
});

suite.export(module);

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js