446add18313d7010c04eed60bf4db714ab46ee05
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);
14 * Load TestSwarm agent
16 if ( QUnit
.urlParams
.swarmURL
) {
17 document
.write("<scr" + "ipt src='" + QUnit
.fixurl( 'data/testwarm.inject.js' ) + "'></scr" + "ipt>");
21 * Load completenesstest
23 if ( QUnit
.urlParams
.completenesstest
) {
25 // Return true to ignore
26 var mwTestIgnore = function( val
, tester
, funcPath
) {
28 // Don't record methods of the properties of constructors,
29 // to avoid getting into a loop (prototype.constructor.prototype..).
30 // Since we're therefor skipping any injection for
31 // "new mw.Foo()", manually set it to true here.
32 if ( val
instanceof mw
.Map
) {
33 tester
.methodCallTracker
['Map'] = true;
36 if ( val
instanceof mw
.Title
) {
37 tester
.methodCallTracker
['Title'] = true;
41 // Don't record methods of the properties of a jQuery object
42 if ( val
instanceof $ ) {
49 var mwTester
= new CompletenessTest( mw
, mwTestIgnore
);
53 * Add-on assertion helpers
58 // Expect boolean true
59 assertTrue: function( actual
, message
) {
60 strictEqual( actual
, true, message
);
63 // Expect boolean false
64 assertFalse: function( actual
, message
) {
65 strictEqual( actual
, false, message
);
68 // Expect numerical value less than X
69 lt: function( actual
, expected
, message
) {
70 QUnit
.push( actual
< expected
, actual
, 'less than ' + expected
, message
);
73 // Expect numerical value less than or equal to X
74 ltOrEq: function( actual
, expected
, message
) {
75 QUnit
.push( actual
<= expected
, actual
, 'less than or equal to ' + expected
, message
);
78 // Expect numerical value greater than X
79 gt: function( actual
, expected
, message
) {
80 QUnit
.push( actual
> expected
, actual
, 'greater than ' + expected
, message
);
83 // Expect numerical value greater than or equal to X
84 gtOrEq: function( actual
, expected
, message
) {
85 QUnit
.push( actual
>= expected
, actual
, 'greater than or equal to ' + expected
, message
);
88 // Backwards compatible with new verions of QUnit
90 same
: window
.deepEqual
93 $.extend( QUnit
, addons
);
94 $.extend( window
, addons
);