-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext-test.js
More file actions
48 lines (44 loc) · 1.25 KB
/
Copy pathtext-test.js
File metadata and controls
48 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require("../env");
require("../../d3");
var vows = require("vows"),
assert = require("assert");
var suite = vows.describe("d3.text");
suite.addBatch({
"text": {
topic: function() {
var cb = this.callback;
return d3.text("examples/data/sample.txt", function(text) {
cb(null, text);
});
},
"invokes the callback with the loaded text": function(text) {
assert.equal(text, "Hello, world!\n");
},
"does not override the mime type by default": function(text) {
assert.isUndefined(XMLHttpRequest._last._info.mimeType);
},
"": {
topic: function() {
var cb = this.callback;
return d3.text("examples/data/sample.txt", "text/plain+sample", function(text) {
cb(null, text);
});
},
"observes the optional mime type": function(text) {
assert.equal(XMLHttpRequest._last._info.mimeType, "text/plain+sample");
}
},
" ": {
topic: function() {
var cb = this.callback;
return d3.text("//does/not/exist.txt", function(text) {
cb(null, text);
});
},
"invokes the callback with null when an error occurs": function(text) {
assert.isNull(text);
}
}
}
});
suite.export(module);