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");
6 tests.register("dojox.collections.tests.ArrayList", [
8 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
9 t.assertEqual(4, al.count);
12 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
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());
18 function testClear(t){
19 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
21 t.assertEqual(0, al.count);
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());
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"));
33 function testGetIterator(t){
34 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
35 var itr=al.getIterator();
39 t.assertEqual("bull", itr.element);
41 function testIndexOf(t){
42 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
43 t.assertEqual(1, al.indexOf("bar"));
45 function testInsert(t){
46 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
48 t.assertEqual(2, al.indexOf("baz"));
51 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
52 t.assertEqual("test", al.item(2));
54 function testRemove(t){
55 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
57 t.assertEqual("foo,test,bull", al.toString());
58 t.assertEqual(3, al.count);
60 function testRemoveAt(t){
61 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
63 t.assertEqual("foo,bar,test", al.toString());
64 t.assertEqual(3, al.count);
66 function testReverse(t){
67 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
69 t.assertEqual("bull,test,bar,foo", al.toString());
72 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
74 t.assertEqual("bar,bull,foo,test", al.toString());
76 function testToArray(t){
77 var al=new dojox.collections.ArrayList(["foo","bar","test","bull"]);
79 t.assertEqual(a.join(","), al.toString());