source: Dev/branches/rest-dojo-ui/client/dojox/lang/tests/object.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: 781 bytes
Line 
1dojo.provide("dojox.lang.tests.object");
2
3dojo.require("dojox.lang.functional.object");
4
5(function(){
6        var df = dojox.lang.functional, x = {a: 1, b: 2, c: 3},
7                print = function(v, i){ this.push("[" + i + "] = " + v); },
8                show = function(o){ return df.forIn(o, print, []).sort().join(", "); };
9       
10        tests.register("dojox.lang.tests.object", [
11                function testKeys(t){ t.assertEqual(df.keys(x).sort(), ["a", "b", "c"]); },
12                function testValues(t){ t.assertEqual(df.values(x).sort(), [1, 2, 3]); },
13               
14                function testForIn(t){ t.assertEqual(show(x), "[a] = 1, [b] = 2, [c] = 3"); },
15                function testFilterIn(t){ t.assertEqual(show(df.filterIn(x, "%2")), "[a] = 1, [c] = 3"); },
16                function testMapIn(t){ t.assertEqual(show(df.mapIn(x, "+3")), "[a] = 4, [b] = 5, [c] = 6"); }
17        ]);
18})();
Note: See TracBrowser for help on using the repository browser.