From: Timo Tijhof Date: Sun, 2 Sep 2012 21:09:11 +0000 (+0200) Subject: Update jquery.qunit from upstream v1.9.0 to v1.10.0 X-Git-Tag: 1.31.0-rc.0~22477 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;ds=sidebyside;h=28678c3d07e6116b6fc0f2523180253746dc0c44;p=lhc%2Fweb%2Fwiklou.git Update jquery.qunit from upstream v1.9.0 to v1.10.0 Upstream: * git-repo: https://github.com/jquery/qunit.git * git-tag: v1.10.0 * git-commit: 900f72051b0112342feda3d700a7a049d886b9ce * tree: https://github.com/jquery/qunit/tree/v1.10.0 * compare: https://github.com/jquery/qunit/compare/v1.9.0...v1.10.0 * release-notes: https://github.com/jquery/qunit/blob/v1.10.0/History.md Change-Id: If8529952a1d9f228ad1c5697057afea12fdf3630 --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index ab374fd24f..535db63873 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -67,7 +67,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * Edit notices can now be translated. * jQuery upgraded to 1.8.1 * jQuery UI upgraded to 1.8.23. -* (bug 35705) QUnit upgraded from v1.2.0 to v1.9.0. +* QUnit upgraded from v1.2.0 to v1.10.0. * (bug 37604) jquery.cookie upgraded to 2011 version. * (bug 22887) Add warning and tracking category for preprocessor errors * (bug 31704) Allow selection of associated namespace on the watchlist diff --git a/resources/jquery/jquery.qunit.css b/resources/jquery/jquery.qunit.css index 257b224ff4..55970e0065 100644 --- a/resources/jquery/jquery.qunit.css +++ b/resources/jquery/jquery.qunit.css @@ -1,11 +1,11 @@ /** - * QUnit v1.9.0 - A JavaScript Unit Testing Framework + * QUnit v1.10.0 - A JavaScript Unit Testing Framework * - * http://docs.jquery.com/QUnit + * http://qunitjs.com * - * Copyright (c) 2012 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license */ /** Font Family and Sizes */ @@ -20,7 +20,7 @@ /** Resets */ -#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { +#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { margin: 0; padding: 0; } @@ -67,6 +67,7 @@ padding: 0.5em 0 0.5em 2em; color: #5E740B; background-color: #eee; + overflow: hidden; } #qunit-userAgent { @@ -76,6 +77,9 @@ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; } +#qunit-modulefilter-container { + float: right; +} /** Tests: Pass/Fail */ diff --git a/resources/jquery/jquery.qunit.js b/resources/jquery/jquery.qunit.js index 9efedcb442..d4f17b5ae5 100644 --- a/resources/jquery/jquery.qunit.js +++ b/resources/jquery/jquery.qunit.js @@ -1,11 +1,11 @@ /** - * QUnit v1.9.0 - A JavaScript Unit Testing Framework + * QUnit v1.10.0 - A JavaScript Unit Testing Framework * - * http://docs.jquery.com/QUnit + * http://qunitjs.com * - * Copyright (c) 2012 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license */ (function( window ) { @@ -17,6 +17,8 @@ var QUnit, fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, + // Keep a local reference to Date (GH-283) + Date = window.Date, defined = { setTimeout: typeof window.setTimeout !== "undefined", sessionStorage: (function() { @@ -304,7 +306,8 @@ QUnit = { // call on start of module test to prepend name to all tests module: function( name, testEnvironment ) { config.currentModule = name; - config.currentModuleTestEnviroment = testEnvironment; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; }, asyncTest: function( testName, expected, callback ) { @@ -336,7 +339,7 @@ QUnit = { async: async, callback: callback, module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnviroment, + moduleTestEnvironment: config.currentModuleTestEnvironment, stack: sourceFromStacktrace( 2 ) }); @@ -349,7 +352,11 @@ QUnit = { // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. expect: function( asserts ) { - config.current.expected = asserts; + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } }, start: function( count ) { @@ -415,6 +422,8 @@ QUnit.assert = { var source, details = { + module: config.current.module, + name: config.current.testName, result: result, message: msg }; @@ -600,6 +609,9 @@ config = { } ], + // Set of all modules. + modules: {}, + // logging callback queues begin: [], done: [], @@ -710,17 +722,10 @@ extend( QUnit, { }, // Resets the test setup. Useful for tests that modify the DOM. - // If jQuery is available, uses jQuery's html(), otherwise just innerHTML. reset: function() { - var fixture; - - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } + var fixture = id( "qunit-fixture" ); + if ( fixture ) { + fixture.innerHTML = config.fixture; } }, @@ -781,6 +786,8 @@ extend( QUnit, { var output, source, details = { + module: config.current.module, + name: config.current.testName, result: result, message: message, actual: actual, @@ -826,6 +833,8 @@ extend( QUnit, { var output, details = { + module: config.current.module, + name: config.current.testName, result: false, message: message }; @@ -916,7 +925,9 @@ QUnit.load = function() { runLoggingCallbacks( "begin", QUnit, {} ); // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes, + var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes, moduleFilter, + numModules = 0, + moduleFilterHtml = "", urlConfigHtml = "", oldconfig = extend( {}, config ); @@ -940,6 +951,15 @@ QUnit.load = function() { urlConfigHtml += ""; } + moduleFilterHtml += ""; + // `userAgent` initialized at top of scope userAgent = id( "qunit-userAgent" ); if ( userAgent ) { @@ -1002,6 +1022,19 @@ QUnit.load = function() { window.location = QUnit.url( params ); }); toolbar.appendChild( urlConfigCheckboxes ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter, "change", function() { + var selectBox = moduleFilter.getElementsByTagName("select")[0], + selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); + }); + toolbar.appendChild(moduleFilter); + } } // `main` initialized at top of scope @@ -1039,9 +1072,9 @@ window.onerror = function ( error, filePath, linerNr ) { } QUnit.pushFailure( error, filePath + ":" + linerNr ); } else { - QUnit.test( "global failure", function() { + QUnit.test( "global failure", extend( function() { QUnit.pushFailure( error, filePath + ":" + linerNr ); - }); + }, { validTest: validTest } ) ); } return false; } @@ -1108,6 +1141,11 @@ function done() { } } + // scroll back to top to show results + if ( window.scrollTo ) { + window.scrollTo(0, 0); + } + runLoggingCallbacks( "done", QUnit, { failed: config.stats.bad, passed: passed, @@ -1123,6 +1161,12 @@ function validTest( test ) { module = config.module && config.module.toLowerCase(), fullName = (test.module + ": " + test.testName).toLowerCase(); + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + if ( config.testNumber ) { return test.testNumber === config.testNumber; } @@ -1404,7 +1448,8 @@ QUnit.equiv = (function() { a.global === b.global && // (gmi) ... a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; + a.multiline === b.multiline && + a.sticky === b.sticky; }, // - skip when the property is a method of an instance (OOP)