Sha256: c26f85d4327fb072ac950dcb4625a925cc2b02e7218a24ee067d0dcbb9975315

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

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

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

suite.addBatch({
  "html": {
    topic: load("xhr/html").expression("d3.html").document(),

    "on a sample file": {
      topic: function(html) {
        html("test/data/sample.html", this.callback);
      },
      "invokes the callback with the loaded html": function(document) {
        assert.equal(document.getElementsByTagName("H1")[0].textContent, "Hello & world!");
      },
      "override the mime type to text/html": function(document) {
        assert.equal(XMLHttpRequest._last._info.mimeType, "text/html");
      }
    },

    "on a file that does not exist": {
      topic: function(html) {
        var callback = this.callback;
        html("//does/not/exist.html", function(error, document) {
          callback(null, document);
        });
      },
      "invokes the callback with undefined when an error occurs": function(document) {
        assert.isUndefined(document);
      }
    }
  }
});

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/xhr/html-test.js
stripmem-0.0.3 lib/stripmem/public/components/d3/test/xhr/html-test.js
stripmem-0.0.2 lib/stripmem/public/components/d3/test/xhr/html-test.js
stripmem-0.0.1 lib/stripmem/public/components/d3/test/xhr/html-test.js