From a381f93b77f9f69d71a7a522a592b0cc0368a3c8 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Mon, 16 May 2011 22:54:54 +0000 Subject: [PATCH] Update deprecated shortcuts to current values as of 2011-version of QUnit * equals -> equal * same -> deepEqual --- .../test/unit/jquery/jquery.colorUtil.js | 52 ++++++------- .../unit/mediawiki.util/mediawiki.util.js | 50 ++++++------ resources/test/unit/mediawiki/mediawiki.js | 78 +++++++++---------- 3 files changed, 90 insertions(+), 90 deletions(-) diff --git a/resources/test/unit/jquery/jquery.colorUtil.js b/resources/test/unit/jquery/jquery.colorUtil.js index c749c3220e..b794887355 100644 --- a/resources/test/unit/jquery/jquery.colorUtil.js +++ b/resources/test/unit/jquery/jquery.colorUtil.js @@ -7,27 +7,27 @@ test( '-- Initial check', function(){ test( 'getRGB', function(){ - equals( typeof jQuery.colorUtil.getRGB(), 'undefined', 'No arguments' ); - equals( typeof jQuery.colorUtil.getRGB( '' ), 'undefined', 'Empty string' ); - same( jQuery.colorUtil.getRGB( [0, 100, 255] ), [0, 100, 255], 'Array' ); - same( jQuery.colorUtil.getRGB( 'rgb(0,100,255)' ), [0, 100, 255], 'Parse simple string' ); - same( jQuery.colorUtil.getRGB( 'rgb(0, 100, 255)' ), [0, 100, 255], 'Parse simple string (whitespace)' ); - same( jQuery.colorUtil.getRGB( 'rgb(0%,20%,40%)' ), [0, 51, 102], 'Parse percentages string' ); - same( jQuery.colorUtil.getRGB( 'rgb(0%, 20%, 40%)' ), [0, 51, 102], 'Parse percentages string (whitespace)' ); - same( jQuery.colorUtil.getRGB( '#f2ddee' ), [242, 221, 238], 'Hex string: 6 char lowercase' ); - same( jQuery.colorUtil.getRGB( '#f2DDEE' ), [242, 221, 238], 'Hex string: 6 char uppercase' ); - same( jQuery.colorUtil.getRGB( '#f2DdEe' ), [242, 221, 238], 'Hex string: 6 char mixed' ); - same( jQuery.colorUtil.getRGB( '#eee' ), [238, 238, 238], 'Hex string: 3 char lowercase' ); - same( jQuery.colorUtil.getRGB( '#EEE' ), [238, 238, 238], 'Hex string: 3 char uppercase' ); - same( jQuery.colorUtil.getRGB( '#eEe' ), [238, 238, 238], 'Hex string: 3 char mixed' ); - same( jQuery.colorUtil.getRGB( 'rgba(0, 0, 0, 0)' ), [255, 255, 255], 'Zero rgba for Safari 3; Transparent (whitespace)' ); + equal( typeof jQuery.colorUtil.getRGB(), 'undefined', 'No arguments' ); + equal( typeof jQuery.colorUtil.getRGB( '' ), 'undefined', 'Empty string' ); + deepEqual( jQuery.colorUtil.getRGB( [0, 100, 255] ), [0, 100, 255], 'Array' ); + deepEqual( jQuery.colorUtil.getRGB( 'rgb(0,100,255)' ), [0, 100, 255], 'Parse simple string' ); + deepEqual( jQuery.colorUtil.getRGB( 'rgb(0, 100, 255)' ), [0, 100, 255], 'Parse simple string (whitespace)' ); + deepEqual( jQuery.colorUtil.getRGB( 'rgb(0%,20%,40%)' ), [0, 51, 102], 'Parse percentages string' ); + deepEqual( jQuery.colorUtil.getRGB( 'rgb(0%, 20%, 40%)' ), [0, 51, 102], 'Parse percentages string (whitespace)' ); + deepEqual( jQuery.colorUtil.getRGB( '#f2ddee' ), [242, 221, 238], 'Hex string: 6 char lowercase' ); + deepEqual( jQuery.colorUtil.getRGB( '#f2DDEE' ), [242, 221, 238], 'Hex string: 6 char uppercase' ); + deepEqual( jQuery.colorUtil.getRGB( '#f2DdEe' ), [242, 221, 238], 'Hex string: 6 char mixed' ); + deepEqual( jQuery.colorUtil.getRGB( '#eee' ), [238, 238, 238], 'Hex string: 3 char lowercase' ); + deepEqual( jQuery.colorUtil.getRGB( '#EEE' ), [238, 238, 238], 'Hex string: 3 char uppercase' ); + deepEqual( jQuery.colorUtil.getRGB( '#eEe' ), [238, 238, 238], 'Hex string: 3 char mixed' ); + deepEqual( jQuery.colorUtil.getRGB( 'rgba(0, 0, 0, 0)' ), [255, 255, 255], 'Zero rgba for Safari 3; Transparent (whitespace)' ); // Perhaps this is a bug in colorUtil, but it is the current behaviour so, let's keep track // would that ever chnge - equals( typeof jQuery.colorUtil.getRGB( 'rgba(0,0,0,0)' ), 'undefined', 'Zero rgba without whitespace' ); + equal( typeof jQuery.colorUtil.getRGB( 'rgba(0,0,0,0)' ), 'undefined', 'Zero rgba without whitespace' ); - same( jQuery.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color names (lightGreen)' ); - same( jQuery.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color names (transparent)' ); - equals( typeof jQuery.colorUtil.getRGB( 'mediaWiki' ), 'undefined', 'Inexisting Color name' ); + deepEqual( jQuery.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color names (lightGreen)' ); + deepEqual( jQuery.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color names (transparent)' ); + equal( typeof jQuery.colorUtil.getRGB( 'mediaWiki' ), 'undefined', 'Inexisting Color name' ); }); @@ -38,9 +38,9 @@ test( 'rgbToHsl', function(){ }; ok( hsl, 'Basic return evaluation' ); - same( dualDecimals(hsl[0]) , 0.33, 'rgb(144, 238, 144): H 0.33' ); - same( dualDecimals(hsl[1]) , 0.73, 'rgb(144, 238, 144): S 0.73' ); - same( dualDecimals(hsl[2]) , 0.75, 'rgb(144, 238, 144): L 0.75' ); + deepEqual( dualDecimals(hsl[0]) , 0.33, 'rgb(144, 238, 144): H 0.33' ); + deepEqual( dualDecimals(hsl[1]) , 0.73, 'rgb(144, 238, 144): S 0.73' ); + deepEqual( dualDecimals(hsl[2]) , 0.75, 'rgb(144, 238, 144): L 0.75' ); }); @@ -48,9 +48,9 @@ test( 'hslToRgb', function(){ var rgb = jQuery.colorUtil.hslToRgb( 0.3, 0.7, 0.8 ); ok( rgb, 'Basic return evaluation' ); - same( Math.round(rgb[0]) , 183, 'hsl(0.3, 0.7, 0.8): R 183' ); - same( Math.round(rgb[1]) , 240, 'hsl(0.3, 0.7, 0.8): G 240' ); - same( Math.round(rgb[2]) , 168, 'hsl(0.3, 0.7, 0.8): B 168' ); + deepEqual( Math.round(rgb[0]) , 183, 'hsl(0.3, 0.7, 0.8): R 183' ); + deepEqual( Math.round(rgb[1]) , 240, 'hsl(0.3, 0.7, 0.8): G 240' ); + deepEqual( Math.round(rgb[2]) , 168, 'hsl(0.3, 0.7, 0.8): B 168' ); }); @@ -58,10 +58,10 @@ test( 'getColorBrightness', function(){ var a = jQuery.colorUtil.getColorBrightness( 'red', +0.1 ); - equals( a, 'rgb(255,50,50)', 'Start with named color, brighten 10%' ); + equal( a, 'rgb(255,50,50)', 'Start with named color, brighten 10%' ); var b = jQuery.colorUtil.getColorBrightness( 'rgb(200,50,50)', -0.2 ); - equals( b, 'rgb(118,29,29)', 'Start with rgb string, darken 10%' ); + equal( b, 'rgb(118,29,29)', 'Start with rgb string, darken 10%' ); }); diff --git a/resources/test/unit/mediawiki.util/mediawiki.util.js b/resources/test/unit/mediawiki.util/mediawiki.util.js index 4569559fe5..2df7d03359 100644 --- a/resources/test/unit/mediawiki.util/mediawiki.util.js +++ b/resources/test/unit/mediawiki.util/mediawiki.util.js @@ -8,13 +8,13 @@ test( '-- Initial check', function(){ test( 'rawurlencode', function(){ - equals( mw.util.rawurlencode( 'Test:A & B/Here' ), 'Test%3AA%20%26%20B%2FHere' ); + equal( mw.util.rawurlencode( 'Test:A & B/Here' ), 'Test%3AA%20%26%20B%2FHere' ); }); test( 'wikiUrlencode', function(){ - equals( mw.util.wikiUrlencode( 'Test:A & B/Here' ), 'Test:A_%26_B/Here' ); + equal( mw.util.wikiUrlencode( 'Test:A & B/Here' ), 'Test:A_%26_B/Here' ); }); @@ -22,10 +22,10 @@ test( 'addCSS', function(){ var a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' ); ok( a, 'function works' ); - same( a.disabled, false, 'property "disabled" is available and set to false' ); + deepEqual( a.disabled, false, 'property "disabled" is available and set to false' ); var $b = $('#bodyContent'); - equals( $b.css('visibility'), 'hidden', 'Added style properties are in effect.' ); + equal( $b.css('visibility'), 'hidden', 'Added style properties are in effect.' ); }); @@ -43,11 +43,11 @@ test( 'wikiGetlink', function(){ var hrefA = mw.util.wikiGetlink( 'Sandbox' ); - equals( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' ); + equal( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' ); var hrefB = mw.util.wikiGetlink( 'Foo:Sandbox ? 5+5=10 ! (test)/subpage' ); - equals( hrefB, '/wiki/Foo:Sandbox_%3F_5%2B5%3D10_%21_%28test%29/subpage', 'Advanced title; Get link for "Foo:Sandbox ? 5+5=10 ! (test)/subpage"' ); + equal( hrefB, '/wiki/Foo:Sandbox_%3F_5%2B5%3D10_%21_%28test%29/subpage', 'Advanced title; Get link for "Foo:Sandbox ? 5+5=10 ! (test)/subpage"' ); }); @@ -131,7 +131,7 @@ test( 'getTitleFrom', function(){ test( 'tooltipAccessKey', function(){ - equals( typeof mw.util.tooltipAccessKeyPrefix, 'string', 'mw.util.tooltipAccessKeyPrefix must be a string' ); + equal( typeof mw.util.tooltipAccessKeyPrefix, 'string', 'mw.util.tooltipAccessKeyPrefix must be a string' ); ok( mw.util.tooltipAccessKeyRegexp instanceof RegExp, 'mw.util.tooltipAccessKeyRegexp instance of RegExp' ); ok( mw.util.updateTooltipAccessKeys, 'mw.util.updateTooltipAccessKeys' ); @@ -140,7 +140,7 @@ test( 'tooltipAccessKey', function(){ test( '$content', function(){ ok( mw.util.$content instanceof jQuery, 'mw.util.$content instance of jQuery' ); - same( mw.util.$content.length, 1, 'mw.util.$content must have length of 1' ); + deepEqual( mw.util.$content.length, 1, 'mw.util.$content must have length of 1' ); }); @@ -152,8 +152,8 @@ test( 'addPortletLink', function(){ var b = mw.util.addPortletLink( "p-tb", "http://mediawiki.org/", "MediaWiki.org", "t-mworg", "Go to MediaWiki.org ", "m", "#t-rl" ); - equals( $(a).text(), 'ResourceLoader', 'Link contains correct text' ); - equals( $(b).next().text(), 'ResourceLoader', 'Link was inserted in correct nextnode position' ); + equal( $(a).text(), 'ResourceLoader', 'Link contains correct text' ); + equal( $(b).next().text(), 'ResourceLoader', 'Link was inserted in correct nextnode position' ); }); @@ -167,36 +167,36 @@ test( 'jsMessage', function(){ test( 'validateEmail', function(){ - same( mw.util.validateEmail( "" ), null, 'Empty string should return null' ); - same( mw.util.validateEmail( "user@localhost" ), true ); + deepEqual( mw.util.validateEmail( "" ), null, 'Empty string should return null' ); + deepEqual( mw.util.validateEmail( "user@localhost" ), true ); // testEmailWithCommasAreInvalids - same( mw.util.validateEmail( "user,foo@example.org" ), false, 'Comma' ); - same( mw.util.validateEmail( "userfoo@ex,ample.org" ), false, 'Comma' ); + deepEqual( mw.util.validateEmail( "user,foo@example.org" ), false, 'Comma' ); + deepEqual( mw.util.validateEmail( "userfoo@ex,ample.org" ), false, 'Comma' ); // testEmailWithHyphens - same( mw.util.validateEmail( "user-foo@example.org" ), true, 'Hyphen' ); - same( mw.util.validateEmail( "userfoo@ex-ample.org" ), true, 'Hyphen' ); + deepEqual( mw.util.validateEmail( "user-foo@example.org" ), true, 'Hyphen' ); + deepEqual( mw.util.validateEmail( "userfoo@ex-ample.org" ), true, 'Hyphen' ); }); test( 'isIPv6Address', function(){ // Based on IPTest.php > IPv6 - same( mw.util.isIPv6Address( "" ), false, 'Empty string is not an IP' ); - same( mw.util.isIPv6Address( ":fc:100::" ), false, 'IPv6 starting with lone ":"' ); - same( mw.util.isIPv6Address( "fc:100::" ), true ); - same( mw.util.isIPv6Address( "fc:100:a:d:1:e:ac::" ), true ); - same( mw.util.isIPv6Address( ":::" ), false ); - same( mw.util.isIPv6Address( "::0:" ), false ); + deepEqual( mw.util.isIPv6Address( "" ), false, 'Empty string is not an IP' ); + deepEqual( mw.util.isIPv6Address( ":fc:100::" ), false, 'IPv6 starting with lone ":"' ); + deepEqual( mw.util.isIPv6Address( "fc:100::" ), true ); + deepEqual( mw.util.isIPv6Address( "fc:100:a:d:1:e:ac::" ), true ); + deepEqual( mw.util.isIPv6Address( ":::" ), false ); + deepEqual( mw.util.isIPv6Address( "::0:" ), false ); }); test( 'isIPv4Address', function(){ // Based on IPTest.php > IPv4 - same( mw.util.isIPv4Address( "" ), false, 'Empty string is not an IP' ); - same( mw.util.isIPv4Address( "...." ), false ); - same( mw.util.isIPv4Address( "1.24.52.13" ), true ); + deepEqual( mw.util.isIPv4Address( "" ), false, 'Empty string is not an IP' ); + deepEqual( mw.util.isIPv4Address( "...." ), false ); + deepEqual( mw.util.isIPv4Address( "1.24.52.13" ), true ); }); diff --git a/resources/test/unit/mediawiki/mediawiki.js b/resources/test/unit/mediawiki/mediawiki.js index 0accb87cf9..d7e84bd83f 100644 --- a/resources/test/unit/mediawiki/mediawiki.js +++ b/resources/test/unit/mediawiki/mediawiki.js @@ -4,51 +4,51 @@ test( '-- Initial check', function(){ ok( window.jQuery, 'jQuery defined' ); ok( window.$j, '$j defined' ); - equals( window.$j, window.jQuery, '$j alias to jQuery' ); + equal( window.$j, window.jQuery, '$j alias to jQuery' ); ok( window.mediaWiki, 'mediaWiki defined' ); ok( window.mw, 'mw defined' ); - equals( window.mw, window.mediaWiki, 'mw alias to mediaWiki' ); + equal( window.mw, window.mediaWiki, 'mw alias to mediaWiki' ); }); test( 'jQuery.extend', function(){ - equals( $j.trimLeft( ' foo bar ' ), 'foo bar ', 'trimLeft' ); - equals( $j.trimRight( ' foo bar ' ), ' foo bar', 'trimRight' ); - equals( $j.ucFirst( 'foo'), 'Foo', 'ucFirst' ); + equal( $j.trimLeft( ' foo bar ' ), 'foo bar ', 'trimLeft' ); + equal( $j.trimRight( ' foo bar ' ), ' foo bar', 'trimRight' ); + equal( $j.ucFirst( 'foo'), 'Foo', 'ucFirst' ); - equals( $j.escapeRE( '