8e6671ed961bb7b97fe7df4d549ef9a58a3e9e3c
4 * Add bogus to url to prevent IE crazy caching
6 * @param value {String} a relative path (eg. 'data/defineTestCallback.js' or 'data/test.php?foo=bar')
7 * @return {String} Such as 'data/defineTestCallback.js?131031765087663960'
9 QUnit
.fixurl = function(value
) {
10 return value
+ (/\?/.test(value
) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math
.random()*100000);
16 QUnit
.config
.testTimeout
= 5000;
19 * Load TestSwarm agent
21 if ( QUnit
.urlParams
.swarmURL
) {
22 document
.write("<scr" + "ipt src='" + QUnit
.fixurl( mw
.config
.get( 'wgScriptPath' ) + '/tests/qunit/data/testwarm.inject.js' ) + "'></scr" + "ipt>");
26 * Load completenesstest
28 if ( QUnit
.urlParams
.completenesstest
) {
30 // Return true to ignore
31 var mwTestIgnore = function( val
, tester
, funcPath
) {
33 // Don't record methods of the properties of constructors,
34 // to avoid getting into a loop (prototype.constructor.prototype..).
35 // Since we're therefor skipping any injection for
36 // "new mw.Foo()", manually set it to true here.
37 if ( val
instanceof mw
.Map
) {
38 tester
.methodCallTracker
['Map'] = true;
41 if ( val
instanceof mw
.Title
) {
42 tester
.methodCallTracker
['Title'] = true;
46 // Don't record methods of the properties of a jQuery object
47 if ( val
instanceof $ ) {
54 var mwTester
= new CompletenessTest( mw
, mwTestIgnore
);
58 * Add-on assertion helpers
63 // Expect boolean true
64 assertTrue: function( actual
, message
) {
65 strictEqual( actual
, true, message
);
68 // Expect boolean false
69 assertFalse: function( actual
, message
) {
70 strictEqual( actual
, false, message
);
73 // Expect numerical value less than X
74 lt: function( actual
, expected
, message
) {
75 QUnit
.push( actual
< expected
, actual
, 'less than ' + expected
, message
);
78 // Expect numerical value less than or equal to X
79 ltOrEq: function( actual
, expected
, message
) {
80 QUnit
.push( actual
<= expected
, actual
, 'less than or equal to ' + expected
, message
);
83 // Expect numerical value greater than X
84 gt: function( actual
, expected
, message
) {
85 QUnit
.push( actual
> expected
, actual
, 'greater than ' + expected
, message
);
88 // Expect numerical value greater than or equal to X
89 gtOrEq: function( actual
, expected
, message
) {
90 QUnit
.push( actual
>= expected
, actual
, 'greater than or equal to ' + expected
, message
);
93 // Backwards compatible with new verions of QUnit
95 same
: window
.deepEqual
98 $.extend( QUnit
, addons
);
99 $.extend( window
, addons
);