From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- tests/qunit/data/generateJqueryMsgData.php | 4 ++-- tests/qunit/data/load.mock.php | 3 ++- tests/qunit/data/testrunner.js | 29 ++++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) (limited to 'tests/qunit/data') diff --git a/tests/qunit/data/generateJqueryMsgData.php b/tests/qunit/data/generateJqueryMsgData.php index 604ede81..12e5a2dc 100644 --- a/tests/qunit/data/generateJqueryMsgData.php +++ b/tests/qunit/data/generateJqueryMsgData.php @@ -61,7 +61,7 @@ * */ -require( __DIR__ . '/../../../maintenance/Maintenance.php' ); +require __DIR__ . '/../../../maintenance/Maintenance.php'; class GenerateJqueryMsgData extends Maintenance { @@ -147,4 +147,4 @@ class GenerateJqueryMsgData extends Maintenance { } $maintClass = "GenerateJqueryMsgData"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN; diff --git a/tests/qunit/data/load.mock.php b/tests/qunit/data/load.mock.php index 7ff392ab..f6eff77a 100644 --- a/tests/qunit/data/load.mock.php +++ b/tests/qunit/data/load.mock.php @@ -24,6 +24,7 @@ */ header( 'Content-Type: text/javascript; charset=utf-8' ); +require_once __DIR__ . '/../../../includes/json/FormatJson.php'; require_once __DIR__ . '/../../../includes/Xml.php'; $moduleImplementations = array( @@ -50,7 +51,7 @@ if ( isset( $_GET['modules'] ) ) { if ( isset( $moduleImplementations[$module] ) ) { $response .= $moduleImplementations[$module]; } else { - $response .= Xml::encodeJsCall( 'mw.loader.state', array( $module, 'missing' ) ); + $response .= Xml::encodeJsCall( 'mw.loader.state', array( $module, 'missing' ), true ); } } } diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 62dd81ac..1a2bfa10 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -38,6 +38,8 @@ tooltip: 'Enable debug mode in ResourceLoader' } ); + QUnit.config.requireExpects = true; + /** * Load TestSwarm agent */ @@ -48,13 +50,14 @@ // of MediaWiki has actually been configured with the required url to that inject.js // script. By default it is false. if ( QUnit.urlParams.swarmURL && mw.config.get( 'QUnitTestSwarmInjectJSPath' ) ) { - document.write( '' ); + jQuery.getScript( QUnit.fixurl( mw.config.get( 'QUnitTestSwarmInjectJSPath' ) ) ); } /** * CompletenessTest + * + * Adds toggle checkbox to header */ - // Adds toggle checkbox to header QUnit.config.urlConfig.push( { id: 'completenesstest', label: 'Run CompletenessTest', @@ -93,8 +96,9 @@ /** * Test environment recommended for all QUnit test modules + * + * Whether to log environment changes to the console */ - // Whether to log environment changes to the console QUnit.config.urlConfig.push( 'mwlogenv' ); /** @@ -347,6 +351,25 @@ assert.equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object restored and re-applied after test()' ); } ); + QUnit.test( 'Loader status', 2, function ( assert ) { + var i, len, state, + modules = mw.loader.getModuleNames(), + error = [], + missing = []; + + for ( i = 0, len = modules.length; i < len; i++ ) { + state = mw.loader.getState( modules[i] ); + if ( state === 'error' ) { + error.push( modules[i] ); + } else if ( state === 'missing' ) { + missing.push( modules[i] ); + } + } + + assert.deepEqual( error, [], 'Modules in error state' ); + assert.deepEqual( missing, [], 'Modules in missing state' ); + } ); + QUnit.test( 'htmlEqual', 8, function ( assert ) { assert.htmlEqual( '

Child paragraph with A link

Regular textA span
', -- cgit v1.2.2