|
1 require("../env"); |
|
2 require("../../d3"); |
|
3 |
|
4 var vows = require("vows"), |
|
5 assert = require("assert"); |
|
6 |
|
7 var suite = vows.describe("ns"); |
|
8 |
|
9 suite.addBatch({ |
|
10 "prefix": { |
|
11 topic: function() { |
|
12 return d3.ns.prefix; |
|
13 }, |
|
14 "svg is http://www.w3.org/2000/svg": function(prefix) { |
|
15 assert.equal(prefix.svg, "http://www.w3.org/2000/svg"); |
|
16 }, |
|
17 "xhtml is http://www.w3.org/1999/xhtml": function(prefix) { |
|
18 assert.equal(prefix.xhtml, "http://www.w3.org/1999/xhtml"); |
|
19 }, |
|
20 "xlink is http://www.w3.org/1999/xlink": function(prefix) { |
|
21 assert.equal(prefix.xlink, "http://www.w3.org/1999/xlink"); |
|
22 }, |
|
23 "xml is http://www.w3.org/XML/1998/namespace": function(prefix) { |
|
24 assert.equal(prefix.xml, "http://www.w3.org/XML/1998/namespace"); |
|
25 }, |
|
26 "xmlns is http://www.w3.org/2000/xmlns/": function(prefix) { |
|
27 assert.equal(prefix.xmlns, "http://www.w3.org/2000/xmlns/"); |
|
28 } |
|
29 } |
|
30 }); |
|
31 |
|
32 suite.addBatch({ |
|
33 "qualify": { |
|
34 topic: function() { |
|
35 return d3.ns.qualify; |
|
36 }, |
|
37 "local name returns name": function() { |
|
38 assert.equal(d3.ns.qualify("local"), "local"); |
|
39 }, |
|
40 "known qualified name returns space and local": function() { |
|
41 var name = d3.ns.qualify("svg:path"); |
|
42 assert.equal(name.space, "http://www.w3.org/2000/svg"); |
|
43 assert.equal(name.local, "path"); |
|
44 }, |
|
45 "unknown qualified name returns undefined and local": function() { |
|
46 var name = d3.ns.qualify("foo:bar"); |
|
47 assert.isUndefined(name.space); |
|
48 assert.equal(name.local, "bar"); |
|
49 } |
|
50 } |
|
51 }); |
|
52 |
|
53 suite.export(module); |