source: Dev/branches/rest-dojo-ui/client/dojox/collections/tests/Stack.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.4 KB
Line 
1dojo.provide("dojox.collections.tests.Stack");
2dojo.require("dojox.collections.Stack");
3
4tests.register("dojox.collections.tests.Stack", [
5        function testCtor(t){
6                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
7                t.assertEqual(4, s.count);
8        },
9        function testClear(t){
10                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
11                s.clear();
12                t.assertEqual(0, s.count);
13        },
14        function testClone(t){
15                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
16                var cloned=s.clone();
17                t.assertEqual(s.count, cloned.count);
18                t.assertEqual(s.toArray().join(), cloned.toArray().join());
19        },
20        function testContains(t){
21                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
22                t.assertTrue(s.contains("bar"));
23                t.assertFalse(s.contains("faz"));
24        },
25        function testGetIterator(t){
26                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
27                var itr=s.getIterator();
28                while(!itr.atEnd()){ itr.get(); }
29                t.assertEqual("bull", itr.element);
30        },
31        function testPeek(t){
32                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
33                t.assertEqual("bull", s.peek());
34        },
35        function testPop(t){
36                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
37                t.assertEqual("bull", s.pop());
38                t.assertEqual("test", s.pop());
39        },
40        function testPush(t){
41                var s=new dojox.collections.Stack(["foo","bar","test","bull"]);
42                s.push("bug");
43                t.assertEqual("bug", s.peek());
44        }
45]);
Note: See TracBrowser for help on using the repository browser.