r87848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87847‎ | r87848 | r87849 >
Date:21:54, 10 May 2011
Author:krinkle
Status:ok
Tags:
Comment:
Step 1 of QUnit/TestSwarm support (bug 26908)
* Add jQuery QUnit module
* Add a return value to mw.Map.prototype.set
* Add fallback to 'body' for options.parent in a new $.messageBox

(this is a re-do of r87830, but without breaking mw.config, see r87830 CR)

--
* Small whitespace fix (spaces to tabs) in Resources.php
Modified paths:
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.messageBox.js (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.qunit.css (added) (history)
  • /trunk/phase3/resources/jquery/jquery.qunit.js (added) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.messageBox.js
@@ -35,6 +35,9 @@
3636 'display': 'none'
3737 }
3838 });
 39+ if ( $( options.parent ).length < 1 ) {
 40+ options.parent = 'body';
 41+ }
3942 if ( options.insert === 'append' ) {
4043 $newBox.appendTo( options.parent );
4144 return $newBox;
Index: trunk/phase3/resources/jquery/jquery.qunit.js
@@ -0,0 +1,1442 @@
 2+/**
 3+ * QUnit - A JavaScript Unit Testing Framework
 4+ *
 5+ * http://docs.jquery.com/QUnit
 6+ *
 7+ * Copyright (c) 2011 John Resig, Jörn Zaefferer
 8+ * Dual licensed under the MIT (MIT-LICENSE.txt)
 9+ * or GPL (GPL-LICENSE.txt) licenses.
 10+ */
 11+
 12+(function(window) {
 13+
 14+var defined = {
 15+ setTimeout: typeof window.setTimeout !== "undefined",
 16+ sessionStorage: (function() {
 17+ try {
 18+ return !!sessionStorage.getItem;
 19+ } catch(e){
 20+ return false;
 21+ }
 22+ })()
 23+};
 24+
 25+var testId = 0;
 26+
 27+var Test = function(name, testName, expected, testEnvironmentArg, async, callback) {
 28+ this.name = name;
 29+ this.testName = testName;
 30+ this.expected = expected;
 31+ this.testEnvironmentArg = testEnvironmentArg;
 32+ this.async = async;
 33+ this.callback = callback;
 34+ this.assertions = [];
 35+};
 36+Test.prototype = {
 37+ init: function() {
 38+ var tests = id("qunit-tests");
 39+ if (tests) {
 40+ var b = document.createElement("strong");
 41+ b.innerHTML = "Running " + this.name;
 42+ var li = document.createElement("li");
 43+ li.appendChild( b );
 44+ li.className = "running";
 45+ li.id = this.id = "test-output" + testId++;
 46+ tests.appendChild( li );
 47+ }
 48+ },
 49+ setup: function() {
 50+ if (this.module != config.previousModule) {
 51+ if ( config.previousModule ) {
 52+ QUnit.moduleDone( {
 53+ name: config.previousModule,
 54+ failed: config.moduleStats.bad,
 55+ passed: config.moduleStats.all - config.moduleStats.bad,
 56+ total: config.moduleStats.all
 57+ } );
 58+ }
 59+ config.previousModule = this.module;
 60+ config.moduleStats = { all: 0, bad: 0 };
 61+ QUnit.moduleStart( {
 62+ name: this.module
 63+ } );
 64+ }
 65+
 66+ config.current = this;
 67+ this.testEnvironment = extend({
 68+ setup: function() {},
 69+ teardown: function() {}
 70+ }, this.moduleTestEnvironment);
 71+ if (this.testEnvironmentArg) {
 72+ extend(this.testEnvironment, this.testEnvironmentArg);
 73+ }
 74+
 75+ QUnit.testStart( {
 76+ name: this.testName
 77+ } );
 78+
 79+ // allow utility functions to access the current test environment
 80+ // TODO why??
 81+ QUnit.current_testEnvironment = this.testEnvironment;
 82+
 83+ try {
 84+ if ( !config.pollution ) {
 85+ saveGlobal();
 86+ }
 87+
 88+ this.testEnvironment.setup.call(this.testEnvironment);
 89+ } catch(e) {
 90+ QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message );
 91+ }
 92+ },
 93+ run: function() {
 94+ if ( this.async ) {
 95+ QUnit.stop();
 96+ }
 97+
 98+ if ( config.notrycatch ) {
 99+ this.callback.call(this.testEnvironment);
 100+ return;
 101+ }
 102+ try {
 103+ this.callback.call(this.testEnvironment);
 104+ } catch(e) {
 105+ fail("Test " + this.testName + " died, exception and test follows", e, this.callback);
 106+ QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) );
 107+ // else next test will carry the responsibility
 108+ saveGlobal();
 109+
 110+ // Restart the tests if they're blocking
 111+ if ( config.blocking ) {
 112+ start();
 113+ }
 114+ }
 115+ },
 116+ teardown: function() {
 117+ try {
 118+ checkPollution();
 119+ this.testEnvironment.teardown.call(this.testEnvironment);
 120+ } catch(e) {
 121+ QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message );
 122+ }
 123+ },
 124+ finish: function() {
 125+ if ( this.expected && this.expected != this.assertions.length ) {
 126+ QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
 127+ }
 128+
 129+ var good = 0, bad = 0,
 130+ tests = id("qunit-tests");
 131+
 132+ config.stats.all += this.assertions.length;
 133+ config.moduleStats.all += this.assertions.length;
 134+
 135+ if ( tests ) {
 136+ var ol = document.createElement("ol");
 137+
 138+ for ( var i = 0; i < this.assertions.length; i++ ) {
 139+ var assertion = this.assertions[i];
 140+
 141+ var li = document.createElement("li");
 142+ li.className = assertion.result ? "pass" : "fail";
 143+ li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed");
 144+ ol.appendChild( li );
 145+
 146+ if ( assertion.result ) {
 147+ good++;
 148+ } else {
 149+ bad++;
 150+ config.stats.bad++;
 151+ config.moduleStats.bad++;
 152+ }
 153+ }
 154+
 155+ // store result when possible
 156+ if ( QUnit.config.reorder && defined.sessionStorage ) {
 157+ if (bad) {
 158+ sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
 159+ } else {
 160+ sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
 161+ }
 162+ }
 163+
 164+ if (bad == 0) {
 165+ ol.style.display = "none";
 166+ }
 167+
 168+ var b = document.createElement("strong");
 169+ b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
 170+
 171+ var a = document.createElement("a");
 172+ a.innerHTML = "Rerun";
 173+ a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
 174+
 175+ addEvent(b, "click", function() {
 176+ var next = b.nextSibling.nextSibling,
 177+ display = next.style.display;
 178+ next.style.display = display === "none" ? "block" : "none";
 179+ });
 180+
 181+ addEvent(b, "dblclick", function(e) {
 182+ var target = e && e.target ? e.target : window.event.srcElement;
 183+ if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
 184+ target = target.parentNode;
 185+ }
 186+ if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
 187+ window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
 188+ }
 189+ });
 190+
 191+ var li = id(this.id);
 192+ li.className = bad ? "fail" : "pass";
 193+ li.removeChild( li.firstChild );
 194+ li.appendChild( b );
 195+ li.appendChild( a );
 196+ li.appendChild( ol );
 197+
 198+ } else {
 199+ for ( var i = 0; i < this.assertions.length; i++ ) {
 200+ if ( !this.assertions[i].result ) {
 201+ bad++;
 202+ config.stats.bad++;
 203+ config.moduleStats.bad++;
 204+ }
 205+ }
 206+ }
 207+
 208+ try {
 209+ QUnit.reset();
 210+ } catch(e) {
 211+ fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset);
 212+ }
 213+
 214+ QUnit.testDone( {
 215+ name: this.testName,
 216+ failed: bad,
 217+ passed: this.assertions.length - bad,
 218+ total: this.assertions.length
 219+ } );
 220+ },
 221+
 222+ queue: function() {
 223+ var test = this;
 224+ synchronize(function() {
 225+ test.init();
 226+ });
 227+ function run() {
 228+ // each of these can by async
 229+ synchronize(function() {
 230+ test.setup();
 231+ });
 232+ synchronize(function() {
 233+ test.run();
 234+ });
 235+ synchronize(function() {
 236+ test.teardown();
 237+ });
 238+ synchronize(function() {
 239+ test.finish();
 240+ });
 241+ }
 242+ // defer when previous test run passed, if storage is available
 243+ var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName);
 244+ if (bad) {
 245+ run();
 246+ } else {
 247+ synchronize(run);
 248+ };
 249+ }
 250+
 251+};
 252+
 253+var QUnit = {
 254+
 255+ // call on start of module test to prepend name to all tests
 256+ module: function(name, testEnvironment) {
 257+ config.currentModule = name;
 258+ config.currentModuleTestEnviroment = testEnvironment;
 259+ },
 260+
 261+ asyncTest: function(testName, expected, callback) {
 262+ if ( arguments.length === 2 ) {
 263+ callback = expected;
 264+ expected = 0;
 265+ }
 266+
 267+ QUnit.test(testName, expected, callback, true);
 268+ },
 269+
 270+ test: function(testName, expected, callback, async) {
 271+ var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
 272+
 273+ if ( arguments.length === 2 ) {
 274+ callback = expected;
 275+ expected = null;
 276+ }
 277+ // is 2nd argument a testEnvironment?
 278+ if ( expected && typeof expected === 'object') {
 279+ testEnvironmentArg = expected;
 280+ expected = null;
 281+ }
 282+
 283+ if ( config.currentModule ) {
 284+ name = '<span class="module-name">' + config.currentModule + "</span>: " + name;
 285+ }
 286+
 287+ if ( !validTest(config.currentModule + ": " + testName) ) {
 288+ return;
 289+ }
 290+
 291+ var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
 292+ test.module = config.currentModule;
 293+ test.moduleTestEnvironment = config.currentModuleTestEnviroment;
 294+ test.queue();
 295+ },
 296+
 297+ /**
 298+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
 299+ */
 300+ expect: function(asserts) {
 301+ config.current.expected = asserts;
 302+ },
 303+
 304+ /**
 305+ * Asserts true.
 306+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
 307+ */
 308+ ok: function(a, msg) {
 309+ a = !!a;
 310+ var details = {
 311+ result: a,
 312+ message: msg
 313+ };
 314+ msg = escapeHtml(msg);
 315+ QUnit.log(details);
 316+ config.current.assertions.push({
 317+ result: a,
 318+ message: msg
 319+ });
 320+ },
 321+
 322+ /**
 323+ * Checks that the first two arguments are equal, with an optional message.
 324+ * Prints out both actual and expected values.
 325+ *
 326+ * Prefered to ok( actual == expected, message )
 327+ *
 328+ * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
 329+ *
 330+ * @param Object actual
 331+ * @param Object expected
 332+ * @param String message (optional)
 333+ */
 334+ equal: function(actual, expected, message) {
 335+ QUnit.push(expected == actual, actual, expected, message);
 336+ },
 337+
 338+ notEqual: function(actual, expected, message) {
 339+ QUnit.push(expected != actual, actual, expected, message);
 340+ },
 341+
 342+ deepEqual: function(actual, expected, message) {
 343+ QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
 344+ },
 345+
 346+ notDeepEqual: function(actual, expected, message) {
 347+ QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message);
 348+ },
 349+
 350+ strictEqual: function(actual, expected, message) {
 351+ QUnit.push(expected === actual, actual, expected, message);
 352+ },
 353+
 354+ notStrictEqual: function(actual, expected, message) {
 355+ QUnit.push(expected !== actual, actual, expected, message);
 356+ },
 357+
 358+ raises: function(block, expected, message) {
 359+ var actual, ok = false;
 360+
 361+ if (typeof expected === 'string') {
 362+ message = expected;
 363+ expected = null;
 364+ }
 365+
 366+ try {
 367+ block();
 368+ } catch (e) {
 369+ actual = e;
 370+ }
 371+
 372+ if (actual) {
 373+ // we don't want to validate thrown error
 374+ if (!expected) {
 375+ ok = true;
 376+ // expected is a regexp
 377+ } else if (QUnit.objectType(expected) === "regexp") {
 378+ ok = expected.test(actual);
 379+ // expected is a constructor
 380+ } else if (actual instanceof expected) {
 381+ ok = true;
 382+ // expected is a validation function which returns true is validation passed
 383+ } else if (expected.call({}, actual) === true) {
 384+ ok = true;
 385+ }
 386+ }
 387+
 388+ QUnit.ok(ok, message);
 389+ },
 390+
 391+ start: function() {
 392+ config.semaphore--;
 393+ if (config.semaphore > 0) {
 394+ // don't start until equal number of stop-calls
 395+ return;
 396+ }
 397+ if (config.semaphore < 0) {
 398+ // ignore if start is called more often then stop
 399+ config.semaphore = 0;
 400+ }
 401+ // A slight delay, to avoid any current callbacks
 402+ if ( defined.setTimeout ) {
 403+ window.setTimeout(function() {
 404+ if ( config.timeout ) {
 405+ clearTimeout(config.timeout);
 406+ }
 407+
 408+ config.blocking = false;
 409+ process();
 410+ }, 13);
 411+ } else {
 412+ config.blocking = false;
 413+ process();
 414+ }
 415+ },
 416+
 417+ stop: function(timeout) {
 418+ config.semaphore++;
 419+ config.blocking = true;
 420+
 421+ if ( timeout && defined.setTimeout ) {
 422+ clearTimeout(config.timeout);
 423+ config.timeout = window.setTimeout(function() {
 424+ QUnit.ok( false, "Test timed out" );
 425+ QUnit.start();
 426+ }, timeout);
 427+ }
 428+ }
 429+};
 430+
 431+// Backwards compatibility, deprecated
 432+QUnit.equals = QUnit.equal;
 433+QUnit.same = QUnit.deepEqual;
 434+
 435+// Maintain internal state
 436+var config = {
 437+ // The queue of tests to run
 438+ queue: [],
 439+
 440+ // block until document ready
 441+ blocking: true,
 442+
 443+ // by default, run previously failed tests first
 444+ // very useful in combination with "Hide passed tests" checked
 445+ reorder: true,
 446+
 447+ noglobals: false,
 448+ notrycatch: false
 449+};
 450+
 451+// Load paramaters
 452+(function() {
 453+ var location = window.location || { search: "", protocol: "file:" },
 454+ params = location.search.slice( 1 ).split( "&" ),
 455+ length = params.length,
 456+ urlParams = {},
 457+ current;
 458+
 459+ if ( params[ 0 ] ) {
 460+ for ( var i = 0; i < length; i++ ) {
 461+ current = params[ i ].split( "=" );
 462+ current[ 0 ] = decodeURIComponent( current[ 0 ] );
 463+ // allow just a key to turn on a flag, e.g., test.html?noglobals
 464+ current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
 465+ urlParams[ current[ 0 ] ] = current[ 1 ];
 466+ if ( current[ 0 ] in config ) {
 467+ config[ current[ 0 ] ] = current[ 1 ];
 468+ }
 469+ }
 470+ }
 471+
 472+ QUnit.urlParams = urlParams;
 473+ config.filter = urlParams.filter;
 474+
 475+ // Figure out if we're running the tests from a server or not
 476+ QUnit.isLocal = !!(location.protocol === 'file:');
 477+})();
 478+
 479+// Expose the API as global variables, unless an 'exports'
 480+// object exists, in that case we assume we're in CommonJS
 481+if ( typeof exports === "undefined" || typeof require === "undefined" ) {
 482+ extend(window, QUnit);
 483+ window.QUnit = QUnit;
 484+} else {
 485+ extend(exports, QUnit);
 486+ exports.QUnit = QUnit;
 487+}
 488+
 489+// define these after exposing globals to keep them in these QUnit namespace only
 490+extend(QUnit, {
 491+ config: config,
 492+
 493+ // Initialize the configuration options
 494+ init: function() {
 495+ extend(config, {
 496+ stats: { all: 0, bad: 0 },
 497+ moduleStats: { all: 0, bad: 0 },
 498+ started: +new Date,
 499+ updateRate: 1000,
 500+ blocking: false,
 501+ autostart: true,
 502+ autorun: false,
 503+ filter: "",
 504+ queue: [],
 505+ semaphore: 0
 506+ });
 507+
 508+ var tests = id( "qunit-tests" ),
 509+ banner = id( "qunit-banner" ),
 510+ result = id( "qunit-testresult" );
 511+
 512+ if ( tests ) {
 513+ tests.innerHTML = "";
 514+ }
 515+
 516+ if ( banner ) {
 517+ banner.className = "";
 518+ }
 519+
 520+ if ( result ) {
 521+ result.parentNode.removeChild( result );
 522+ }
 523+
 524+ if ( tests ) {
 525+ result = document.createElement( "p" );
 526+ result.id = "qunit-testresult";
 527+ result.className = "result";
 528+ tests.parentNode.insertBefore( result, tests );
 529+ result.innerHTML = 'Running...<br/>&nbsp;';
 530+ }
 531+ },
 532+
 533+ /**
 534+ * Resets the test setup. Useful for tests that modify the DOM.
 535+ *
 536+ * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
 537+ */
 538+ reset: function() {
 539+ if ( window.jQuery ) {
 540+ jQuery( "#qunit-fixture" ).html( config.fixture );
 541+ } else {
 542+ var main = id( 'qunit-fixture' );
 543+ if ( main ) {
 544+ main.innerHTML = config.fixture;
 545+ }
 546+ }
 547+ },
 548+
 549+ /**
 550+ * Trigger an event on an element.
 551+ *
 552+ * @example triggerEvent( document.body, "click" );
 553+ *
 554+ * @param DOMElement elem
 555+ * @param String type
 556+ */
 557+ triggerEvent: function( elem, type, event ) {
 558+ if ( document.createEvent ) {
 559+ event = document.createEvent("MouseEvents");
 560+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
 561+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
 562+ elem.dispatchEvent( event );
 563+
 564+ } else if ( elem.fireEvent ) {
 565+ elem.fireEvent("on"+type);
 566+ }
 567+ },
 568+
 569+ // Safe object type checking
 570+ is: function( type, obj ) {
 571+ return QUnit.objectType( obj ) == type;
 572+ },
 573+
 574+ objectType: function( obj ) {
 575+ if (typeof obj === "undefined") {
 576+ return "undefined";
 577+
 578+ // consider: typeof null === object
 579+ }
 580+ if (obj === null) {
 581+ return "null";
 582+ }
 583+
 584+ var type = Object.prototype.toString.call( obj )
 585+ .match(/^\[object\s(.*)\]$/)[1] || '';
 586+
 587+ switch (type) {
 588+ case 'Number':
 589+ if (isNaN(obj)) {
 590+ return "nan";
 591+ } else {
 592+ return "number";
 593+ }
 594+ case 'String':
 595+ case 'Boolean':
 596+ case 'Array':
 597+ case 'Date':
 598+ case 'RegExp':
 599+ case 'Function':
 600+ return type.toLowerCase();
 601+ }
 602+ if (typeof obj === "object") {
 603+ return "object";
 604+ }
 605+ return undefined;
 606+ },
 607+
 608+ push: function(result, actual, expected, message) {
 609+ var details = {
 610+ result: result,
 611+ message: message,
 612+ actual: actual,
 613+ expected: expected
 614+ };
 615+
 616+ message = escapeHtml(message) || (result ? "okay" : "failed");
 617+ message = '<span class="test-message">' + message + "</span>";
 618+ expected = escapeHtml(QUnit.jsDump.parse(expected));
 619+ actual = escapeHtml(QUnit.jsDump.parse(actual));
 620+ var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
 621+ if (actual != expected) {
 622+ output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
 623+ output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
 624+ }
 625+ if (!result) {
 626+ var source = sourceFromStacktrace();
 627+ if (source) {
 628+ details.source = source;
 629+ output += '<tr class="test-source"><th>Source: </th><td><pre>' + source +'</pre></td></tr>';
 630+ }
 631+ }
 632+ output += "</table>";
 633+
 634+ QUnit.log(details);
 635+
 636+ config.current.assertions.push({
 637+ result: !!result,
 638+ message: output
 639+ });
 640+ },
 641+
 642+ url: function( params ) {
 643+ params = extend( extend( {}, QUnit.urlParams ), params );
 644+ var querystring = "?",
 645+ key;
 646+ for ( key in params ) {
 647+ querystring += encodeURIComponent( key ) + "=" +
 648+ encodeURIComponent( params[ key ] ) + "&";
 649+ }
 650+ return window.location.pathname + querystring.slice( 0, -1 );
 651+ },
 652+
 653+ // Logging callbacks; all receive a single argument with the listed properties
 654+ // run test/logs.html for any related changes
 655+ begin: function() {},
 656+ // done: { failed, passed, total, runtime }
 657+ done: function() {},
 658+ // log: { result, actual, expected, message }
 659+ log: function() {},
 660+ // testStart: { name }
 661+ testStart: function() {},
 662+ // testDone: { name, failed, passed, total }
 663+ testDone: function() {},
 664+ // moduleStart: { name }
 665+ moduleStart: function() {},
 666+ // moduleDone: { name, failed, passed, total }
 667+ moduleDone: function() {}
 668+});
 669+
 670+if ( typeof document === "undefined" || document.readyState === "complete" ) {
 671+ config.autorun = true;
 672+}
 673+
 674+addEvent(window, "load", function() {
 675+ QUnit.begin({});
 676+
 677+ // Initialize the config, saving the execution queue
 678+ var oldconfig = extend({}, config);
 679+ QUnit.init();
 680+ extend(config, oldconfig);
 681+
 682+ config.blocking = false;
 683+
 684+ var userAgent = id("qunit-userAgent");
 685+ if ( userAgent ) {
 686+ userAgent.innerHTML = navigator.userAgent;
 687+ }
 688+ var banner = id("qunit-header");
 689+ if ( banner ) {
 690+ banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' +
 691+ '<label><input name="noglobals" type="checkbox"' + ( config.noglobals ? ' checked="checked"' : '' ) + '>noglobals</label>' +
 692+ '<label><input name="notrycatch" type="checkbox"' + ( config.notrycatch ? ' checked="checked"' : '' ) + '>notrycatch</label>';
 693+ addEvent( banner, "change", function( event ) {
 694+ var params = {};
 695+ params[ event.target.name ] = event.target.checked ? true : undefined;
 696+ window.location = QUnit.url( params );
 697+ });
 698+ }
 699+
 700+ var toolbar = id("qunit-testrunner-toolbar");
 701+ if ( toolbar ) {
 702+ var filter = document.createElement("input");
 703+ filter.type = "checkbox";
 704+ filter.id = "qunit-filter-pass";
 705+ addEvent( filter, "click", function() {
 706+ var ol = document.getElementById("qunit-tests");
 707+ if ( filter.checked ) {
 708+ ol.className = ol.className + " hidepass";
 709+ } else {
 710+ var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
 711+ ol.className = tmp.replace(/ hidepass /, " ");
 712+ }
 713+ if ( defined.sessionStorage ) {
 714+ if (filter.checked) {
 715+ sessionStorage.setItem("qunit-filter-passed-tests", "true");
 716+ } else {
 717+ sessionStorage.removeItem("qunit-filter-passed-tests");
 718+ }
 719+ }
 720+ });
 721+ if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
 722+ filter.checked = true;
 723+ var ol = document.getElementById("qunit-tests");
 724+ ol.className = ol.className + " hidepass";
 725+ }
 726+ toolbar.appendChild( filter );
 727+
 728+ var label = document.createElement("label");
 729+ label.setAttribute("for", "qunit-filter-pass");
 730+ label.innerHTML = "Hide passed tests";
 731+ toolbar.appendChild( label );
 732+ }
 733+
 734+ var main = id('qunit-fixture');
 735+ if ( main ) {
 736+ config.fixture = main.innerHTML;
 737+ }
 738+
 739+ if (config.autostart) {
 740+ QUnit.start();
 741+ }
 742+});
 743+
 744+function done() {
 745+ config.autorun = true;
 746+
 747+ // Log the last module results
 748+ if ( config.currentModule ) {
 749+ QUnit.moduleDone( {
 750+ name: config.currentModule,
 751+ failed: config.moduleStats.bad,
 752+ passed: config.moduleStats.all - config.moduleStats.bad,
 753+ total: config.moduleStats.all
 754+ } );
 755+ }
 756+
 757+ var banner = id("qunit-banner"),
 758+ tests = id("qunit-tests"),
 759+ runtime = +new Date - config.started,
 760+ passed = config.stats.all - config.stats.bad,
 761+ html = [
 762+ 'Tests completed in ',
 763+ runtime,
 764+ ' milliseconds.<br/>',
 765+ '<span class="passed">',
 766+ passed,
 767+ '</span> tests of <span class="total">',
 768+ config.stats.all,
 769+ '</span> passed, <span class="failed">',
 770+ config.stats.bad,
 771+ '</span> failed.'
 772+ ].join('');
 773+
 774+ if ( banner ) {
 775+ banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
 776+ }
 777+
 778+ if ( tests ) {
 779+ id( "qunit-testresult" ).innerHTML = html;
 780+ }
 781+
 782+ QUnit.done( {
 783+ failed: config.stats.bad,
 784+ passed: passed,
 785+ total: config.stats.all,
 786+ runtime: runtime
 787+ } );
 788+}
 789+
 790+function validTest( name ) {
 791+ var filter = config.filter,
 792+ run = false;
 793+
 794+ if ( !filter ) {
 795+ return true;
 796+ }
 797+
 798+ not = filter.charAt( 0 ) === "!";
 799+ if ( not ) {
 800+ filter = filter.slice( 1 );
 801+ }
 802+
 803+ if ( name.indexOf( filter ) !== -1 ) {
 804+ return !not;
 805+ }
 806+
 807+ if ( not ) {
 808+ run = true;
 809+ }
 810+
 811+ return run;
 812+}
 813+
 814+// so far supports only Firefox, Chrome and Opera (buggy)
 815+// could be extended in the future to use something like https://github.com/csnover/TraceKit
 816+function sourceFromStacktrace() {
 817+ try {
 818+ throw new Error();
 819+ } catch ( e ) {
 820+ if (e.stacktrace) {
 821+ // Opera
 822+ return e.stacktrace.split("\n")[6];
 823+ } else if (e.stack) {
 824+ // Firefox, Chrome
 825+ return e.stack.split("\n")[4];
 826+ }
 827+ }
 828+}
 829+
 830+function escapeHtml(s) {
 831+ if (!s) {
 832+ return "";
 833+ }
 834+ s = s + "";
 835+ return s.replace(/[\&"<>\\]/g, function(s) {
 836+ switch(s) {
 837+ case "&": return "&amp;";
 838+ case "\\": return "\\\\";
 839+ case '"': return '\"';
 840+ case "<": return "&lt;";
 841+ case ">": return "&gt;";
 842+ default: return s;
 843+ }
 844+ });
 845+}
 846+
 847+function synchronize( callback ) {
 848+ config.queue.push( callback );
 849+
 850+ if ( config.autorun && !config.blocking ) {
 851+ process();
 852+ }
 853+}
 854+
 855+function process() {
 856+ var start = (new Date()).getTime();
 857+
 858+ while ( config.queue.length && !config.blocking ) {
 859+ if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
 860+ config.queue.shift()();
 861+ } else {
 862+ window.setTimeout( process, 13 );
 863+ break;
 864+ }
 865+ }
 866+ if (!config.blocking && !config.queue.length) {
 867+ done();
 868+ }
 869+}
 870+
 871+function saveGlobal() {
 872+ config.pollution = [];
 873+
 874+ if ( config.noglobals ) {
 875+ for ( var key in window ) {
 876+ config.pollution.push( key );
 877+ }
 878+ }
 879+}
 880+
 881+function checkPollution( name ) {
 882+ var old = config.pollution;
 883+ saveGlobal();
 884+
 885+ var newGlobals = diff( config.pollution, old );
 886+ if ( newGlobals.length > 0 ) {
 887+ ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
 888+ }
 889+
 890+ var deletedGlobals = diff( old, config.pollution );
 891+ if ( deletedGlobals.length > 0 ) {
 892+ ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
 893+ }
 894+}
 895+
 896+// returns a new Array with the elements that are in a but not in b
 897+function diff( a, b ) {
 898+ var result = a.slice();
 899+ for ( var i = 0; i < result.length; i++ ) {
 900+ for ( var j = 0; j < b.length; j++ ) {
 901+ if ( result[i] === b[j] ) {
 902+ result.splice(i, 1);
 903+ i--;
 904+ break;
 905+ }
 906+ }
 907+ }
 908+ return result;
 909+}
 910+
 911+function fail(message, exception, callback) {
 912+ if ( typeof console !== "undefined" && console.error && console.warn ) {
 913+ console.error(message);
 914+ console.error(exception);
 915+ console.warn(callback.toString());
 916+
 917+ } else if ( window.opera && opera.postError ) {
 918+ opera.postError(message, exception, callback.toString);
 919+ }
 920+}
 921+
 922+function extend(a, b) {
 923+ for ( var prop in b ) {
 924+ if ( b[prop] === undefined ) {
 925+ delete a[prop];
 926+ } else {
 927+ a[prop] = b[prop];
 928+ }
 929+ }
 930+
 931+ return a;
 932+}
 933+
 934+function addEvent(elem, type, fn) {
 935+ if ( elem.addEventListener ) {
 936+ elem.addEventListener( type, fn, false );
 937+ } else if ( elem.attachEvent ) {
 938+ elem.attachEvent( "on" + type, fn );
 939+ } else {
 940+ fn();
 941+ }
 942+}
 943+
 944+function id(name) {
 945+ return !!(typeof document !== "undefined" && document && document.getElementById) &&
 946+ document.getElementById( name );
 947+}
 948+
 949+// Test for equality any JavaScript type.
 950+// Discussions and reference: http://philrathe.com/articles/equiv
 951+// Test suites: http://philrathe.com/tests/equiv
 952+// Author: Philippe Rathé <prathe@gmail.com>
 953+QUnit.equiv = function () {
 954+
 955+ var innerEquiv; // the real equiv function
 956+ var callers = []; // stack to decide between skip/abort functions
 957+ var parents = []; // stack to avoiding loops from circular referencing
 958+
 959+ // Call the o related callback with the given arguments.
 960+ function bindCallbacks(o, callbacks, args) {
 961+ var prop = QUnit.objectType(o);
 962+ if (prop) {
 963+ if (QUnit.objectType(callbacks[prop]) === "function") {
 964+ return callbacks[prop].apply(callbacks, args);
 965+ } else {
 966+ return callbacks[prop]; // or undefined
 967+ }
 968+ }
 969+ }
 970+
 971+ var callbacks = function () {
 972+
 973+ // for string, boolean, number and null
 974+ function useStrictEquality(b, a) {
 975+ if (b instanceof a.constructor || a instanceof b.constructor) {
 976+ // to catch short annotaion VS 'new' annotation of a declaration
 977+ // e.g. var i = 1;
 978+ // var j = new Number(1);
 979+ return a == b;
 980+ } else {
 981+ return a === b;
 982+ }
 983+ }
 984+
 985+ return {
 986+ "string": useStrictEquality,
 987+ "boolean": useStrictEquality,
 988+ "number": useStrictEquality,
 989+ "null": useStrictEquality,
 990+ "undefined": useStrictEquality,
 991+
 992+ "nan": function (b) {
 993+ return isNaN(b);
 994+ },
 995+
 996+ "date": function (b, a) {
 997+ return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf();
 998+ },
 999+
 1000+ "regexp": function (b, a) {
 1001+ return QUnit.objectType(b) === "regexp" &&
 1002+ a.source === b.source && // the regex itself
 1003+ a.global === b.global && // and its modifers (gmi) ...
 1004+ a.ignoreCase === b.ignoreCase &&
 1005+ a.multiline === b.multiline;
 1006+ },
 1007+
 1008+ // - skip when the property is a method of an instance (OOP)
 1009+ // - abort otherwise,
 1010+ // initial === would have catch identical references anyway
 1011+ "function": function () {
 1012+ var caller = callers[callers.length - 1];
 1013+ return caller !== Object &&
 1014+ typeof caller !== "undefined";
 1015+ },
 1016+
 1017+ "array": function (b, a) {
 1018+ var i, j, loop;
 1019+ var len;
 1020+
 1021+ // b could be an object literal here
 1022+ if ( ! (QUnit.objectType(b) === "array")) {
 1023+ return false;
 1024+ }
 1025+
 1026+ len = a.length;
 1027+ if (len !== b.length) { // safe and faster
 1028+ return false;
 1029+ }
 1030+
 1031+ //track reference to avoid circular references
 1032+ parents.push(a);
 1033+ for (i = 0; i < len; i++) {
 1034+ loop = false;
 1035+ for(j=0;j<parents.length;j++){
 1036+ if(parents[j] === a[i]){
 1037+ loop = true;//dont rewalk array
 1038+ }
 1039+ }
 1040+ if (!loop && ! innerEquiv(a[i], b[i])) {
 1041+ parents.pop();
 1042+ return false;
 1043+ }
 1044+ }
 1045+ parents.pop();
 1046+ return true;
 1047+ },
 1048+
 1049+ "object": function (b, a) {
 1050+ var i, j, loop;
 1051+ var eq = true; // unless we can proove it
 1052+ var aProperties = [], bProperties = []; // collection of strings
 1053+
 1054+ // comparing constructors is more strict than using instanceof
 1055+ if ( a.constructor !== b.constructor) {
 1056+ return false;
 1057+ }
 1058+
 1059+ // stack constructor before traversing properties
 1060+ callers.push(a.constructor);
 1061+ //track reference to avoid circular references
 1062+ parents.push(a);
 1063+
 1064+ for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
 1065+ loop = false;
 1066+ for(j=0;j<parents.length;j++){
 1067+ if(parents[j] === a[i])
 1068+ loop = true; //don't go down the same path twice
 1069+ }
 1070+ aProperties.push(i); // collect a's properties
 1071+
 1072+ if (!loop && ! innerEquiv(a[i], b[i])) {
 1073+ eq = false;
 1074+ break;
 1075+ }
 1076+ }
 1077+
 1078+ callers.pop(); // unstack, we are done
 1079+ parents.pop();
 1080+
 1081+ for (i in b) {
 1082+ bProperties.push(i); // collect b's properties
 1083+ }
 1084+
 1085+ // Ensures identical properties name
 1086+ return eq && innerEquiv(aProperties.sort(), bProperties.sort());
 1087+ }
 1088+ };
 1089+ }();
 1090+
 1091+ innerEquiv = function () { // can take multiple arguments
 1092+ var args = Array.prototype.slice.apply(arguments);
 1093+ if (args.length < 2) {
 1094+ return true; // end transition
 1095+ }
 1096+
 1097+ return (function (a, b) {
 1098+ if (a === b) {
 1099+ return true; // catch the most you can
 1100+ } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || QUnit.objectType(a) !== QUnit.objectType(b)) {
 1101+ return false; // don't lose time with error prone cases
 1102+ } else {
 1103+ return bindCallbacks(a, callbacks, [b, a]);
 1104+ }
 1105+
 1106+ // apply transition with (1..n) arguments
 1107+ })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
 1108+ };
 1109+
 1110+ return innerEquiv;
 1111+
 1112+}();
 1113+
 1114+/**
 1115+ * jsDump
 1116+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 1117+ * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
 1118+ * Date: 5/15/2008
 1119+ * @projectDescription Advanced and extensible data dumping for Javascript.
 1120+ * @version 1.0.0
 1121+ * @author Ariel Flesler
 1122+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
 1123+ */
 1124+QUnit.jsDump = (function() {
 1125+ function quote( str ) {
 1126+ return '"' + str.toString().replace(/"/g, '\\"') + '"';
 1127+ };
 1128+ function literal( o ) {
 1129+ return o + '';
 1130+ };
 1131+ function join( pre, arr, post ) {
 1132+ var s = jsDump.separator(),
 1133+ base = jsDump.indent(),
 1134+ inner = jsDump.indent(1);
 1135+ if ( arr.join )
 1136+ arr = arr.join( ',' + s + inner );
 1137+ if ( !arr )
 1138+ return pre + post;
 1139+ return [ pre, inner + arr, base + post ].join(s);
 1140+ };
 1141+ function array( arr ) {
 1142+ var i = arr.length, ret = Array(i);
 1143+ this.up();
 1144+ while ( i-- )
 1145+ ret[i] = this.parse( arr[i] );
 1146+ this.down();
 1147+ return join( '[', ret, ']' );
 1148+ };
 1149+
 1150+ var reName = /^function (\w+)/;
 1151+
 1152+ var jsDump = {
 1153+ parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
 1154+ var parser = this.parsers[ type || this.typeOf(obj) ];
 1155+ type = typeof parser;
 1156+
 1157+ return type == 'function' ? parser.call( this, obj ) :
 1158+ type == 'string' ? parser :
 1159+ this.parsers.error;
 1160+ },
 1161+ typeOf:function( obj ) {
 1162+ var type;
 1163+ if ( obj === null ) {
 1164+ type = "null";
 1165+ } else if (typeof obj === "undefined") {
 1166+ type = "undefined";
 1167+ } else if (QUnit.is("RegExp", obj)) {
 1168+ type = "regexp";
 1169+ } else if (QUnit.is("Date", obj)) {
 1170+ type = "date";
 1171+ } else if (QUnit.is("Function", obj)) {
 1172+ type = "function";
 1173+ } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") {
 1174+ type = "window";
 1175+ } else if (obj.nodeType === 9) {
 1176+ type = "document";
 1177+ } else if (obj.nodeType) {
 1178+ type = "node";
 1179+ } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
 1180+ type = "array";
 1181+ } else {
 1182+ type = typeof obj;
 1183+ }
 1184+ return type;
 1185+ },
 1186+ separator:function() {
 1187+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
 1188+ },
 1189+ indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
 1190+ if ( !this.multiline )
 1191+ return '';
 1192+ var chr = this.indentChar;
 1193+ if ( this.HTML )
 1194+ chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
 1195+ return Array( this._depth_ + (extra||0) ).join(chr);
 1196+ },
 1197+ up:function( a ) {
 1198+ this._depth_ += a || 1;
 1199+ },
 1200+ down:function( a ) {
 1201+ this._depth_ -= a || 1;
 1202+ },
 1203+ setParser:function( name, parser ) {
 1204+ this.parsers[name] = parser;
 1205+ },
 1206+ // The next 3 are exposed so you can use them
 1207+ quote:quote,
 1208+ literal:literal,
 1209+ join:join,
 1210+ //
 1211+ _depth_: 1,
 1212+ // This is the list of parsers, to modify them, use jsDump.setParser
 1213+ parsers:{
 1214+ window: '[Window]',
 1215+ document: '[Document]',
 1216+ error:'[ERROR]', //when no parser is found, shouldn't happen
 1217+ unknown: '[Unknown]',
 1218+ 'null':'null',
 1219+ 'undefined':'undefined',
 1220+ 'function':function( fn ) {
 1221+ var ret = 'function',
 1222+ name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
 1223+ if ( name )
 1224+ ret += ' ' + name;
 1225+ ret += '(';
 1226+
 1227+ ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
 1228+ return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
 1229+ },
 1230+ array: array,
 1231+ nodelist: array,
 1232+ arguments: array,
 1233+ object:function( map ) {
 1234+ var ret = [ ];
 1235+ QUnit.jsDump.up();
 1236+ for ( var key in map )
 1237+ ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) );
 1238+ QUnit.jsDump.down();
 1239+ return join( '{', ret, '}' );
 1240+ },
 1241+ node:function( node ) {
 1242+ var open = QUnit.jsDump.HTML ? '&lt;' : '<',
 1243+ close = QUnit.jsDump.HTML ? '&gt;' : '>';
 1244+
 1245+ var tag = node.nodeName.toLowerCase(),
 1246+ ret = open + tag;
 1247+
 1248+ for ( var a in QUnit.jsDump.DOMAttrs ) {
 1249+ var val = node[QUnit.jsDump.DOMAttrs[a]];
 1250+ if ( val )
 1251+ ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' );
 1252+ }
 1253+ return ret + close + open + '/' + tag + close;
 1254+ },
 1255+ functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
 1256+ var l = fn.length;
 1257+ if ( !l ) return '';
 1258+
 1259+ var args = Array(l);
 1260+ while ( l-- )
 1261+ args[l] = String.fromCharCode(97+l);//97 is 'a'
 1262+ return ' ' + args.join(', ') + ' ';
 1263+ },
 1264+ key:quote, //object calls it internally, the key part of an item in a map
 1265+ functionCode:'[code]', //function calls it internally, it's the content of the function
 1266+ attribute:quote, //node calls it internally, it's an html attribute value
 1267+ string:quote,
 1268+ date:quote,
 1269+ regexp:literal, //regex
 1270+ number:literal,
 1271+ 'boolean':literal
 1272+ },
 1273+ DOMAttrs:{//attributes to dump from nodes, name=>realName
 1274+ id:'id',
 1275+ name:'name',
 1276+ 'class':'className'
 1277+ },
 1278+ HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
 1279+ indentChar:' ',//indentation unit
 1280+ multiline:true //if true, items in a collection, are separated by a \n, else just a space.
 1281+ };
 1282+
 1283+ return jsDump;
 1284+})();
 1285+
 1286+// from Sizzle.js
 1287+function getText( elems ) {
 1288+ var ret = "", elem;
 1289+
 1290+ for ( var i = 0; elems[i]; i++ ) {
 1291+ elem = elems[i];
 1292+
 1293+ // Get the text from text nodes and CDATA nodes
 1294+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
 1295+ ret += elem.nodeValue;
 1296+
 1297+ // Traverse everything else, except comment nodes
 1298+ } else if ( elem.nodeType !== 8 ) {
 1299+ ret += getText( elem.childNodes );
 1300+ }
 1301+ }
 1302+
 1303+ return ret;
 1304+};
 1305+
 1306+/*
 1307+ * Javascript Diff Algorithm
 1308+ * By John Resig (http://ejohn.org/)
 1309+ * Modified by Chu Alan "sprite"
 1310+ *
 1311+ * Released under the MIT license.
 1312+ *
 1313+ * More Info:
 1314+ * http://ejohn.org/projects/javascript-diff-algorithm/
 1315+ *
 1316+ * Usage: QUnit.diff(expected, actual)
 1317+ *
 1318+ * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
 1319+ */
 1320+QUnit.diff = (function() {
 1321+ function diff(o, n){
 1322+ var ns = new Object();
 1323+ var os = new Object();
 1324+
 1325+ for (var i = 0; i < n.length; i++) {
 1326+ if (ns[n[i]] == null)
 1327+ ns[n[i]] = {
 1328+ rows: new Array(),
 1329+ o: null
 1330+ };
 1331+ ns[n[i]].rows.push(i);
 1332+ }
 1333+
 1334+ for (var i = 0; i < o.length; i++) {
 1335+ if (os[o[i]] == null)
 1336+ os[o[i]] = {
 1337+ rows: new Array(),
 1338+ n: null
 1339+ };
 1340+ os[o[i]].rows.push(i);
 1341+ }
 1342+
 1343+ for (var i in ns) {
 1344+ if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
 1345+ n[ns[i].rows[0]] = {
 1346+ text: n[ns[i].rows[0]],
 1347+ row: os[i].rows[0]
 1348+ };
 1349+ o[os[i].rows[0]] = {
 1350+ text: o[os[i].rows[0]],
 1351+ row: ns[i].rows[0]
 1352+ };
 1353+ }
 1354+ }
 1355+
 1356+ for (var i = 0; i < n.length - 1; i++) {
 1357+ if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
 1358+ n[i + 1] == o[n[i].row + 1]) {
 1359+ n[i + 1] = {
 1360+ text: n[i + 1],
 1361+ row: n[i].row + 1
 1362+ };
 1363+ o[n[i].row + 1] = {
 1364+ text: o[n[i].row + 1],
 1365+ row: i + 1
 1366+ };
 1367+ }
 1368+ }
 1369+
 1370+ for (var i = n.length - 1; i > 0; i--) {
 1371+ if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
 1372+ n[i - 1] == o[n[i].row - 1]) {
 1373+ n[i - 1] = {
 1374+ text: n[i - 1],
 1375+ row: n[i].row - 1
 1376+ };
 1377+ o[n[i].row - 1] = {
 1378+ text: o[n[i].row - 1],
 1379+ row: i - 1
 1380+ };
 1381+ }
 1382+ }
 1383+
 1384+ return {
 1385+ o: o,
 1386+ n: n
 1387+ };
 1388+ }
 1389+
 1390+ return function(o, n){
 1391+ o = o.replace(/\s+$/, '');
 1392+ n = n.replace(/\s+$/, '');
 1393+ var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
 1394+
 1395+ var str = "";
 1396+
 1397+ var oSpace = o.match(/\s+/g);
 1398+ if (oSpace == null) {
 1399+ oSpace = [" "];
 1400+ }
 1401+ else {
 1402+ oSpace.push(" ");
 1403+ }
 1404+ var nSpace = n.match(/\s+/g);
 1405+ if (nSpace == null) {
 1406+ nSpace = [" "];
 1407+ }
 1408+ else {
 1409+ nSpace.push(" ");
 1410+ }
 1411+
 1412+ if (out.n.length == 0) {
 1413+ for (var i = 0; i < out.o.length; i++) {
 1414+ str += '<del>' + out.o[i] + oSpace[i] + "</del>";
 1415+ }
 1416+ }
 1417+ else {
 1418+ if (out.n[0].text == null) {
 1419+ for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
 1420+ str += '<del>' + out.o[n] + oSpace[n] + "</del>";
 1421+ }
 1422+ }
 1423+
 1424+ for (var i = 0; i < out.n.length; i++) {
 1425+ if (out.n[i].text == null) {
 1426+ str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
 1427+ }
 1428+ else {
 1429+ var pre = "";
 1430+
 1431+ for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
 1432+ pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
 1433+ }
 1434+ str += " " + out.n[i].text + nSpace[i] + pre;
 1435+ }
 1436+ }
 1437+ }
 1438+
 1439+ return str;
 1440+ };
 1441+})();
 1442+
 1443+})(this);
\ No newline at end of file
Property changes on: trunk/phase3/resources/jquery/jquery.qunit.js
___________________________________________________________________
Added: svn:eol-style
11444 + native
Index: trunk/phase3/resources/jquery/jquery.qunit.css
@@ -0,0 +1,225 @@
 2+/**
 3+ * QUnit - A JavaScript Unit Testing Framework
 4+ *
 5+ * http://docs.jquery.com/QUnit
 6+ *
 7+ * Copyright (c) 2011 John Resig, Jörn Zaefferer
 8+ * Dual licensed under the MIT (MIT-LICENSE.txt)
 9+ * or GPL (GPL-LICENSE.txt) licenses.
 10+ */
 11+
 12+/** Font Family and Sizes */
 13+
 14+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
 15+ font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
 16+}
 17+
 18+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
 19+#qunit-tests { font-size: smaller; }
 20+
 21+
 22+/** Resets */
 23+
 24+#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
 25+ margin: 0;
 26+ padding: 0;
 27+}
 28+
 29+
 30+/** Header */
 31+
 32+#qunit-header {
 33+ padding: 0.5em 0 0.5em 1em;
 34+
 35+ color: #8699a4;
 36+ background-color: #0d3349;
 37+
 38+ font-size: 1.5em;
 39+ line-height: 1em;
 40+ font-weight: normal;
 41+
 42+ border-radius: 15px 15px 0 0;
 43+ -moz-border-radius: 15px 15px 0 0;
 44+ -webkit-border-top-right-radius: 15px;
 45+ -webkit-border-top-left-radius: 15px;
 46+}
 47+
 48+#qunit-header a {
 49+ text-decoration: none;
 50+ color: #c2ccd1;
 51+}
 52+
 53+#qunit-header a:hover,
 54+#qunit-header a:focus {
 55+ color: #fff;
 56+}
 57+
 58+#qunit-banner {
 59+ height: 5px;
 60+}
 61+
 62+#qunit-testrunner-toolbar {
 63+ padding: 0.5em 0 0.5em 2em;
 64+ color: #5E740B;
 65+ background-color: #eee;
 66+}
 67+
 68+#qunit-userAgent {
 69+ padding: 0.5em 0 0.5em 2.5em;
 70+ background-color: #2b81af;
 71+ color: #fff;
 72+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
 73+}
 74+
 75+
 76+/** Tests: Pass/Fail */
 77+
 78+#qunit-tests {
 79+ list-style-position: inside;
 80+}
 81+
 82+#qunit-tests li {
 83+ padding: 0.4em 0.5em 0.4em 2.5em;
 84+ border-bottom: 1px solid #fff;
 85+ list-style-position: inside;
 86+}
 87+
 88+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
 89+ display: none;
 90+}
 91+
 92+#qunit-tests li strong {
 93+ cursor: pointer;
 94+}
 95+
 96+#qunit-tests li a {
 97+ padding: 0.5em;
 98+ color: #c2ccd1;
 99+ text-decoration: none;
 100+}
 101+#qunit-tests li a:hover,
 102+#qunit-tests li a:focus {
 103+ color: #000;
 104+}
 105+
 106+#qunit-tests ol {
 107+ margin-top: 0.5em;
 108+ padding: 0.5em;
 109+
 110+ background-color: #fff;
 111+
 112+ border-radius: 15px;
 113+ -moz-border-radius: 15px;
 114+ -webkit-border-radius: 15px;
 115+
 116+ box-shadow: inset 0px 2px 13px #999;
 117+ -moz-box-shadow: inset 0px 2px 13px #999;
 118+ -webkit-box-shadow: inset 0px 2px 13px #999;
 119+}
 120+
 121+#qunit-tests table {
 122+ border-collapse: collapse;
 123+ margin-top: .2em;
 124+}
 125+
 126+#qunit-tests th {
 127+ text-align: right;
 128+ vertical-align: top;
 129+ padding: 0 .5em 0 0;
 130+}
 131+
 132+#qunit-tests td {
 133+ vertical-align: top;
 134+}
 135+
 136+#qunit-tests pre {
 137+ margin: 0;
 138+ white-space: pre-wrap;
 139+ word-wrap: break-word;
 140+}
 141+
 142+#qunit-tests del {
 143+ background-color: #e0f2be;
 144+ color: #374e0c;
 145+ text-decoration: none;
 146+}
 147+
 148+#qunit-tests ins {
 149+ background-color: #ffcaca;
 150+ color: #500;
 151+ text-decoration: none;
 152+}
 153+
 154+/*** Test Counts */
 155+
 156+#qunit-tests b.counts { color: black; }
 157+#qunit-tests b.passed { color: #5E740B; }
 158+#qunit-tests b.failed { color: #710909; }
 159+
 160+#qunit-tests li li {
 161+ margin: 0.5em;
 162+ padding: 0.4em 0.5em 0.4em 0.5em;
 163+ background-color: #fff;
 164+ border-bottom: none;
 165+ list-style-position: inside;
 166+}
 167+
 168+/*** Passing Styles */
 169+
 170+#qunit-tests li li.pass {
 171+ color: #5E740B;
 172+ background-color: #fff;
 173+ border-left: 26px solid #C6E746;
 174+}
 175+
 176+#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
 177+#qunit-tests .pass .test-name { color: #366097; }
 178+
 179+#qunit-tests .pass .test-actual,
 180+#qunit-tests .pass .test-expected { color: #999999; }
 181+
 182+#qunit-banner.qunit-pass { background-color: #C6E746; }
 183+
 184+/*** Failing Styles */
 185+
 186+#qunit-tests li li.fail {
 187+ color: #710909;
 188+ background-color: #fff;
 189+ border-left: 26px solid #EE5757;
 190+}
 191+
 192+#qunit-tests > li:last-child {
 193+ border-radius: 0 0 15px 15px;
 194+ -moz-border-radius: 0 0 15px 15px;
 195+ -webkit-border-bottom-right-radius: 15px;
 196+ -webkit-border-bottom-left-radius: 15px;
 197+}
 198+
 199+#qunit-tests .fail { color: #000000; background-color: #EE5757; }
 200+#qunit-tests .fail .test-name,
 201+#qunit-tests .fail .module-name { color: #000000; }
 202+
 203+#qunit-tests .fail .test-actual { color: #EE5757; }
 204+#qunit-tests .fail .test-expected { color: green; }
 205+
 206+#qunit-banner.qunit-fail { background-color: #EE5757; }
 207+
 208+
 209+/** Result */
 210+
 211+#qunit-testresult {
 212+ padding: 0.5em 0.5em 0.5em 2.5em;
 213+
 214+ color: #2b81af;
 215+ background-color: #D2E0E6;
 216+
 217+ border-bottom: 1px solid white;
 218+}
 219+
 220+/** Fixture */
 221+
 222+#qunit-fixture {
 223+ position: absolute;
 224+ top: -10000px;
 225+ left: -10000px;
 226+}
\ No newline at end of file
Property changes on: trunk/phase3/resources/jquery/jquery.qunit.css
___________________________________________________________________
Added: svn:eol-style
1227 + native
Index: trunk/phase3/resources/Resources.php
@@ -38,7 +38,7 @@
3939 ),
4040 'skins.modern' => array(
4141 'styles' => array( 'modern/main.css' => array( 'media' => 'screen' ),
42 - 'modern/print.css' => array( 'media' => 'print' ) ),
 42+ 'modern/print.css' => array( 'media' => 'print' ) ),
4343 'remoteBasePath' => $GLOBALS['wgStylePath'],
4444 'localBasePath' => "{$GLOBALS['IP']}/skins",
4545 ),
@@ -132,6 +132,10 @@
133133 'styles' => 'resources/jquery/jquery.makeCollapsible.css',
134134 'messages' => array( 'collapsible-expand', 'collapsible-collapse' ),
135135 ),
 136+ 'jquery.qunit' => array(
 137+ 'scripts' => 'resources/jquery/jquery.qunit.js',
 138+ 'styles' => 'resources/jquery/jquery.qunit.css',
 139+ ),
136140 'jquery.suggestions' => array(
137141 'scripts' => 'resources/jquery/jquery.suggestions.js',
138142 'styles' => 'resources/jquery/jquery.suggestions.css',
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -187,9 +187,12 @@
188188 for ( var s in selection ) {
189189 this.values[s] = selection[s];
190190 }
 191+ return true;
191192 } else if ( typeof selection === 'string' && typeof value !== 'undefined' ) {
192193 this.values[selection] = value;
 194+ return true;
193195 }
 196+ return false;
194197 };
195198
196199 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87830Step 1 of QUnit/TestSwarm support (bug 26908)...krinkle17:53, 10 May 2011
r87846Revert r87830: broke ResourceLoader, MediaWiki config variablesbrion21:37, 10 May 2011

Status & tagging log