]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojox/collections/tests/ArrayList.js
Comment class stub
[eow] / static / dojo-release-1.1.1 / dojox / collections / tests / ArrayList.js
1 if(!dojo._hasResource["dojox.collections.tests.ArrayList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.collections.tests.ArrayList"] = true;
3 dojo.provide("dojox.collections.tests.ArrayList");
4 dojo.require("dojox.collections.ArrayList");
5
6 tests.register("dojox.collections.tests.ArrayList", [
7         function testCtor(t){
8                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
9                 t.assertEqual(4, al.count);
10         },
11         function testAdd(t){
12                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
13                 al.add("carp");
14                 t.assertEqual("foo,bar,test,bull,carp", al.toString());
15                 al.addRange(["oof","rab"]);
16                 t.assertEqual("foo,bar,test,bull,carp,oof,rab", al.toString());
17         },
18         function testClear(t){
19                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
20                 al.clear();
21                 t.assertEqual(0, al.count);
22         },
23         function testClone(t){
24                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
25                 var cloned=al.clone();
26                 t.assertEqual(al.toString(), cloned.toString());
27         },
28         function testContains(t){
29                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
30                 t.assertTrue(al.contains("bar"));
31                 t.assertFalse(al.contains("faz"));
32         },
33         function testGetIterator(t){
34                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
35                 var itr=al.getIterator();
36                 while(!itr.atEnd()){
37                         itr.get();
38                 }
39                 t.assertEqual("bull", itr.element);
40         },
41         function testIndexOf(t){
42                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
43                 t.assertEqual(1, al.indexOf("bar"));
44         },
45         function testInsert(t){
46                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
47                 al.insert(2, "baz");
48                 t.assertEqual(2, al.indexOf("baz"));
49         },
50         function testItem(t){
51                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
52                 t.assertEqual("test", al.item(2));
53         },
54         function testRemove(t){
55                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
56                 al.remove("bar");
57                 t.assertEqual("foo,test,bull", al.toString());
58                 t.assertEqual(3, al.count);
59         },
60         function testRemoveAt(t){
61                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
62                 al.removeAt(3);
63                 t.assertEqual("foo,bar,test", al.toString());
64                 t.assertEqual(3, al.count);
65         },
66         function testReverse(t){
67                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
68                 al.reverse();
69                 t.assertEqual("bull,test,bar,foo", al.toString());
70         },
71         function testSort(t){
72                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
73                 al.sort();
74                 t.assertEqual("bar,bull,foo,test", al.toString());
75         },
76         function testToArray(t){
77                 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
78                 var a=al.toArray();
79                 t.assertEqual(a.join(","), al.toString());
80         }
81 ]);
82
83 }