Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js |
— | — | @@ -15,22 +15,28 @@ |
16 | 16 | }); |
17 | 17 | |
18 | 18 | test( 'mw.Map', function() { |
19 | | - expect(15); |
| 19 | + expect(17); |
20 | 20 | |
21 | 21 | ok( mw.Map, 'mw.Map defined' ); |
22 | 22 | |
23 | 23 | var conf = new mw.Map(), |
| 24 | + // Dummy variables |
24 | 25 | funky = function() {}, |
25 | 26 | arry = [], |
26 | 27 | nummy = 7; |
27 | 28 | |
| 29 | + // Tests for input validation |
28 | 30 | strictEqual( conf.get( 'inexistantKey' ), null, 'Map.get returns null if selection was a string and the key was not found' ); |
29 | 31 | strictEqual( conf.set( 'myKey', 'myValue' ), true, 'Map.set returns boolean true if a value was set for a valid key string' ); |
30 | 32 | strictEqual( conf.set( funky, 'Funky' ), false, 'Map.set returns boolean false if key was invalid (Function)' ); |
31 | 33 | strictEqual( conf.set( arry, 'Arry' ), false, 'Map.set returns boolean false if key was invalid (Array)' ); |
32 | 34 | strictEqual( conf.set( nummy, 'Nummy' ), false, 'Map.set returns boolean false if key was invalid (Number)' ); |
33 | 35 | equal( conf.get( 'myKey' ), 'myValue', 'Map.get returns a single value value correctly' ); |
| 36 | + // @broken (these currently return the values object) |
| 37 | + strictEqual( conf.get( nummy ), null, 'Map.get ruturns null if selection was invalid (Number)' ); |
| 38 | + strictEqual( conf.get( funky ), null, 'Map.get ruturns null if selection was invalid (Function)' ); |
34 | 39 | |
| 40 | + // Multiple values at once |
35 | 41 | var someValues = { |
36 | 42 | 'foo': 'bar', |
37 | 43 | 'lorem': 'ipsum', |
— | — | @@ -49,6 +55,8 @@ |
50 | 56 | |
51 | 57 | strictEqual( conf.exists( 'foo' ), true, 'Map.exists returns boolean true if a key exists' ); |
52 | 58 | strictEqual( conf.exists( 'notExist' ), false, 'Map.exists returns boolean false if a key does not exists' ); |
| 59 | + |
| 60 | + // Interacting with globals and accessing the values object |
53 | 61 | strictEqual( conf.get(), conf.values, 'Map.get returns the entire values object by reference (if called without arguments)' ); |
54 | 62 | |
55 | 63 | conf.set( 'globalMapChecker', 'Hi' ); |