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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
if(!dojo._hasResource["dojox.collections.tests.Dictionary"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.collections.tests.Dictionary"] = true;
dojo.provide("dojox.collections.tests.Dictionary");
dojo.require("dojox.collections.Dictionary");
tests.register("dojox.collections.tests.Dictionary", [
function testCtor(t){
var d=new dojox.collections.Dictionary();
t.assertTrue(d instanceof dojox.collections.Dictionary);
},
function testAdd(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
t.assertEqual("bar", d.item("foo").valueOf());
},
function testClear(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.clear()
t.assertEqual(0, d.count);
},
function testClone(t){
var d=new dojox.collections.Dictionary();
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
var d2 = d.clone();
t.assertTrue(d2.contains("baz"));
},
function testContains(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
t.assertTrue(d.contains("baz"));
},
function testContainsKey(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
t.assertTrue(d.containsKey("buck"));
},
function testContainsValue(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
t.assertTrue(d.containsValue("shot"));
},
function testGetKeyList(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
t.assertEqual("foo,baz,buck,apple", d.getKeyList().join(","));
},
function testGetValueList(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
t.assertEqual("bar,fab,shot,orange", d.getValueList().join(","));
},
function testRemove(t){
var d=new dojox.collections.Dictionary();
d.add("foo","bar");
d.add("baz","fab");
d.add("buck","shot");
d.add("apple","orange");
d.remove("baz");
t.assertEqual(3, d.count);
t.assertEqual(undefined, d.item("baz"));
}
]);
}
|