Index: trunk/phase3/tests/qunit/data/defineTestCallback.js |
— | — | @@ -1,4 +0,0 @@ |
2 | | -window.mw.loader.testCallback = function() { |
3 | | - start(); |
4 | | - ok( true, 'Implementing a module, is the callback timed properly ?'); |
5 | | -}; |
Index: trunk/phase3/tests/qunit/data/testrunner.js |
— | — | @@ -6,9 +6,9 @@ |
7 | 7 | /** |
8 | 8 | * Add bogus to url to prevent IE crazy caching |
9 | 9 | * |
10 | | - * @param value {String} a relative path (eg. 'data/defineTestCallback.js' |
| 10 | + * @param value {String} a relative path (eg. 'data/foo.js' |
11 | 11 | * or 'data/test.php?foo=bar'). |
12 | | - * @return {String} Such as 'data/defineTestCallback.js?131031765087663960' |
| 12 | + * @return {String} Such as 'data/foo.js?131031765087663960' |
13 | 13 | */ |
14 | 14 | QUnit.fixurl = function (value) { |
15 | 15 | return value + (/\?/.test( value ) ? '&' : '?') |
Index: trunk/phase3/tests/qunit/data/callMwLoaderTestCallback.js |
— | — | @@ -0,0 +1 @@ |
| 2 | +mw.loader.testCallback(); |
Property changes on: trunk/phase3/tests/qunit/data/callMwLoaderTestCallback.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 3 | + native |
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.js |
— | — | @@ -144,23 +144,31 @@ |
145 | 145 | }); |
146 | 146 | |
147 | 147 | test( 'mw.loader', function() { |
148 | | - expect(1); |
| 148 | + expect(2); |
149 | 149 | |
| 150 | + var isAwesomeDone; |
| 151 | + |
150 | 152 | // Asynchronous ahead |
151 | 153 | stop(); |
152 | 154 | |
153 | | - mw.loader.implement( 'is.awesome', [QUnit.fixurl( mw.config.get( 'wgScriptPath' ) + '/tests/qunit/data/defineTestCallback.js' )], {}, {} ); |
| 155 | + mw.loader.testCallback = function () { |
| 156 | + start(); |
| 157 | + strictEqual( isAwesomeDone, undefined, 'Implementing module is.awesome: isAwesomeDone should still be undefined'); |
| 158 | + isAwesomeDone = true; |
| 159 | + }; |
154 | 160 | |
155 | | - mw.loader.using( 'is.awesome', function() { |
| 161 | + mw.loader.implement( 'is.awesome', [QUnit.fixurl( mw.config.get( 'wgScriptPath' ) + '/tests/qunit/data/callMwLoaderTestCallback.js' )], {}, {} ); |
156 | 162 | |
| 163 | + mw.loader.using( 'is.awesome', function () { |
| 164 | + |
157 | 165 | // /sample/awesome.js declares the "mw.loader.testCallback" function |
158 | 166 | // which contains a call to start() and ok() |
159 | | - mw.loader.testCallback(); |
160 | | - mw.loader.testCallback = undefined; |
| 167 | + strictEqual(isAwesomeDone, true, "is.awesome module should've caused isAwesomeDone to be true") |
| 168 | + delete mw.loader.testCallback; |
161 | 169 | |
162 | | - }, function() { |
| 170 | + }, function () { |
163 | 171 | start(); |
164 | | - ok( false, 'Error callback fired while implementing "is.awesome" module' ); |
| 172 | + ok( false, 'Error callback fired while loader.using "is.awesome" module' ); |
165 | 173 | }); |
166 | 174 | |
167 | 175 | }); |