From 526f19aa518c82c1aeb23f3b8d803c70a8ed29b4 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Sun, 15 May 2011 10:47:37 +0000 Subject: [PATCH] Redo r88144 --- resources/Resources.php | 1 - .../mediawiki.util/mediawiki.util.test.js | 497 ------------------ 2 files changed, 498 deletions(-) delete mode 100644 resources/mediawiki.util/mediawiki.util.test.js diff --git a/resources/Resources.php b/resources/Resources.php index efc38f5161..134b66598d 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -444,7 +444,6 @@ return array( 'jquery.makeCollapsible', 'jquery.placeholder', ), - 'debugScripts' => 'resources/mediawiki.util/mediawiki.util.test.js', ), 'mediawiki.util.jpegmeta' => array( 'scripts' => 'resources/mediawiki.util/mediawiki.util.jpegmeta.js', diff --git a/resources/mediawiki.util/mediawiki.util.test.js b/resources/mediawiki.util/mediawiki.util.test.js deleted file mode 100644 index 35beabab4a..0000000000 --- a/resources/mediawiki.util/mediawiki.util.test.js +++ /dev/null @@ -1,497 +0,0 @@ -/** - * mediaWiki JavaScript library test suite - * - * Available on Special:BlankPage?action=mwutiltest&debug=true - * - * @author Krinkle - */ - -( function( $, mw ) { - - mw.test = { - - /* Variables */ - '$table' : null, - // contains either a header or a test - // test: [ code, result, contain ] see addTest - // header: [ 'HEADER', escapedtitle, id ] see addHead - 'addedTests' : [], - 'headResults' : [], - 'numberOfHeader' : 0, - - /* Functions */ - - /** - * Adds a row to the test-table - * - * @param code String Code of the test to be executed - * @param result String Expected result in 'var (vartype)' form - * @param contain String Important part of the result, - * if result is different but does contain this it will not return ERROR but PARTIALLY - */ - 'addTest' : function( code, result, contain ) { - if ( !contain ) { - contain = result; - } - this.addedTests.push( [code, result, contain] ); - this.$table.append( '' - + '' + mw.html.escape( code ).replace( / /g, '  ' ) - + '' + mw.html.escape( result ).replace( / /g, '  ' ) - + '?' ); - return true; - }, - - /** - * Adds a heading to the test-table - * - * @param title String Title of the section - */ - 'addHead' : function( title ) { - if ( !title ) { - return false; - } - var escapedtitle = mw.html.escape( title ).replace( / /g, '  ' ); - this.addedTests.push( [ 'HEADER', escapedtitle, mw.test.numberOfHeader++ ] ); - this.$table.append( - '' - + escapedtitle + '' - ); - return true; - }, - - /* Initialisation */ - 'initialised' : false, - 'init' : function() { - if ( this.initialised === false ) { - this.initialised = true; - - $(document).ready( function() { - if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Blankpage' - && mw.util.getParamValue( 'action' ) === 'mwutiltest' ) { - - // Build page - document.title = 'mediaWiki JavaScript library test suite - ' + mw.config.get( 'wgSiteName' ); - $( '#firstHeading' ).text( 'mediaWiki JavaScript library test suite' ); - var skinLinksHtml = 'Test in: ', - skinLinks = [], - availableSkins = mw.config.get( 'wgAvailableSkins' ), - skincode = ''; - for ( skincode in availableSkins ) { - skinLinks.push( - mw.html.element( - 'a', { - 'href': mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) - + '?action=mwutiltest&debug=true&useskin=' + encodeURIComponent( skincode ) - }, - availableSkins[skincode] - ) - ); - } - skinLinksHtml += skinLinks.join( ' | ' ) + '.'; - mw.util.$content.html( - '

Below is a list of tests to confirm proper functionality of the mediaWiki JavaScript library

' - + '

' + skinLinksHtml + '

' - + '
' - + '' - + '' - + '
ExecShould returnDoes returnEqual ?
' - ); - - mw.util.addCSS( - // Override wikitable padding for - '#mw-mwutiltest-table tr td { padding:0 !important; }' - ); - - mw.test.$table = $( 'table#mw-mwutiltest-table' ); - - /* Populate tests */ - // Try to roughly keep the order similar to the order in the files - // or alphabetical (depending on the context) - - /** Main modules and their aliases **/ - mw.test.addHead( 'Main modules and their aliases' ); - - mw.test.addTest( 'typeof mediaWiki', - 'object (string)' ); - - mw.test.addTest( 'typeof mw', - 'object (string)' ); - - mw.test.addTest( 'typeof jQuery', - 'function (string)' ); - - mw.test.addTest( 'typeof $', - 'function (string)' ); - - /** Prototype functions added by MediaWiki **/ - mw.test.addHead( 'Prototype functions added by MediaWiki' ); - - mw.test.addTest( 'typeof $.trimLeft', - 'function (string)' ); - - mw.test.addTest( '$.trimLeft( " foo bar " )', - 'foo bar (string)' ); - - mw.test.addTest( 'typeof $.trimRight', - 'function (string)' ); - - mw.test.addTest( '$.trimRight( " foo bar " )', - ' foo bar (string)' ); - - mw.test.addTest( 'typeof $.ucFirst', - 'function (string)' ); - - mw.test.addTest( '$.ucFirst( "mediawiki" )', - 'Mediawiki (string)' ); - - mw.test.addTest( 'typeof $.escapeRE', - 'function (string)' ); - - mw.test.addTest( '$.escapeRE( "