forked from d3/d3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathns-test.js
More file actions
57 lines (54 loc) · 1.91 KB
/
Copy pathns-test.js
File metadata and controls
57 lines (54 loc) · 1.91 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
49
50
51
52
53
54
55
56
57
var vows = require("vows"),
load = require("../load"),
assert = require("../assert");
var suite = vows.describe("ns");
suite.addBatch({
"ns": {
topic: load("core/ns").expression("d3.ns"),
"prefix": {
topic: function(ns) {
return ns.prefix;
},
"svg is http://www.w3.org/2000/svg": function(prefix) {
assert.equal(prefix.svg, "http://www.w3.org/2000/svg");
},
"xhtml is http://www.w3.org/1999/xhtml": function(prefix) {
assert.equal(prefix.xhtml, "http://www.w3.org/1999/xhtml");
},
"xlink is http://www.w3.org/1999/xlink": function(prefix) {
assert.equal(prefix.xlink, "http://www.w3.org/1999/xlink");
},
"xml is http://www.w3.org/XML/1998/namespace": function(prefix) {
assert.equal(prefix.xml, "http://www.w3.org/XML/1998/namespace");
},
"xmlns is http://www.w3.org/2000/xmlns/": function(prefix) {
assert.equal(prefix.xmlns, "http://www.w3.org/2000/xmlns/");
}
},
"qualify": {
topic: function(ns) {
return ns.qualify;
},
"local name returns name": function(qualify) {
assert.equal(qualify("local"), "local");
},
"known qualified name returns space and local": function(qualify) {
var name = qualify("svg:path");
assert.equal(name.space, "http://www.w3.org/2000/svg");
assert.equal(name.local, "path");
},
"unknown qualified name returns name": function(qualify) {
assert.equal(qualify("foo:bar"), "bar");
},
"known local name returns space and local": function(qualify) {
var name = qualify("svg");
assert.equal(name.space, "http://www.w3.org/2000/svg");
assert.equal(name.local, "svg");
},
"names that collide with built-ins are ignored": function(qualify) {
assert.equal(qualify("hasOwnProperty:test"), "test");
}
}
}
});
suite.export(module);