From: Krinkle Date: Sat, 30 Jul 2011 07:38:01 +0000 (+0000) Subject: Adding unit test for bug 27427. Currently broken. Fix (provided by Michael M. through... X-Git-Tag: 1.31.0-rc.0~28540 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=34a73a3e9a34b8b609ce900a2adcdaad5454717f;p=lhc%2Fweb%2Fwiklou.git Adding unit test for bug 27427. Currently broken. Fix (provided by Michael M. through BugZilla) will be committed afterwards. * (bug 27427) mw.util.getParamValue shouldn't return value from hash even if param is only present in hash --- diff --git a/CREDITS b/CREDITS index 25e5d2a5c7..06108ad771 100644 --- a/CREDITS +++ b/CREDITS @@ -122,6 +122,7 @@ following names for their contribution to the product. * Max Sikström * Michael Dale * Michael De La Rue +* Michael M. * Michael Walsh * Mike Horvath * Mormegil diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.util.js b/tests/qunit/suites/resources/mediawiki/mediawiki.util.js index 7fb8fe9db1..4dfb0dcb35 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.util.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.util.js @@ -107,12 +107,15 @@ test( 'toggleToc', function() { }); test( 'getParamValue', function() { - expect(2); + expect(3); + + var url1 = 'http://mediawiki.org/?foo=wrong&foo=right#&foo=bad'; - var url = 'http://mediawiki.org/?foo=wrong&foo=right#&foo=bad'; + equal( mw.util.getParamValue( 'foo', url1 ), 'right', 'Use latest one, ignore hash' ); + strictEqual( mw.util.getParamValue( 'bar', url1 ), null, 'Return null when not found' ); - equal( mw.util.getParamValue( 'foo', url ), 'right', 'Use latest one, ignore hash' ); - strictEqual( mw.util.getParamValue( 'bar', url ), null, 'Return null when not found' ); + var url2 = 'http://mediawiki.org/#&foo=bad'; + strictEqual( mw.util.getParamValue( 'foo', url2 ), null, 'Ignore hash if param is not in querystring but in hash (bug 27427)' ); }); test( 'tooltipAccessKey', function() {