X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki%2Fmediawiki.Uri.test.js;h=e56c93379afde69707d99114fce1eceaba6a6bdd;hb=6cdcc7416c64a635df9aa15170d2df13ecbbd82d;hp=97185fca7310400740939121ca347d66da2259bd;hpb=37751ee23e7b7019307eafe36f18c8450bf2e420;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js index 97185fca73..e56c93379a 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js @@ -11,7 +11,7 @@ } ) ); $.each( [ true, false ], function ( i, strictMode ) { - QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', 2, function ( assert ) { + QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', function ( assert ) { var uriString, uri; uriString = 'http://www.ietf.org/rfc/rfc2396.txt'; uri = new mw.Uri( uriString, { @@ -59,7 +59,7 @@ } ); } ); - QUnit.test( 'Constructor( String[, Object ] )', 11, function ( assert ) { + QUnit.test( 'Constructor( String[, Object ] )', function ( assert ) { var uri; uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', { @@ -132,7 +132,6 @@ } ); assert.equal( uri.toString(), 'http://example.com/bar/baz', 'normalize URI without protocol or // in loose mode' ); - /*jshint -W001 */ uri = new mw.Uri( 'http://example.com/index.php?key=key&hasOwnProperty=hasOwnProperty&constructor=constructor&watch=watch' ); assert.deepEqual( uri.query, @@ -144,10 +143,9 @@ }, 'Keys in query strings support names of Object prototypes (bug T114344)' ); - /*jshint +W001 */ } ); - QUnit.test( 'Constructor( Object )', 3, function ( assert ) { + QUnit.test( 'Constructor( Object )', function ( assert ) { var uri = new mw.Uri( { protocol: 'http', host: 'www.foo.local', @@ -178,10 +176,10 @@ ); } ); - QUnit.test( 'Constructor( empty )', 4, function ( assert ) { + QUnit.test( 'Constructor( empty[, Object ] )', function ( assert ) { var testuri, MyUri, uri; - testuri = 'http://example.org/w/index.php'; + testuri = 'http://example.org/w/index.php?a=1&a=2'; MyUri = mw.UriRelative( testuri ); uri = new MyUri(); @@ -195,9 +193,12 @@ uri = new MyUri( '' ); assert.equal( uri.toString(), testuri, 'empty string' ); + + uri = new MyUri( null, { overrideKeys: true } ); + assert.deepEqual( uri.query, { a: '2' }, 'null, with options' ); } ); - QUnit.test( 'Properties', 8, function ( assert ) { + QUnit.test( 'Properties', function ( assert ) { var uriBase, uri; uriBase = new mw.Uri( 'http://en.wiki.local/w/api.php' ); @@ -230,7 +231,7 @@ assert.ok( uri.toString().indexOf( 'pif=paf' ) >= 0, 'extend query arguments' ); } ); - QUnit.test( '.getQueryString()', 2, function ( assert ) { + QUnit.test( '.getQueryString()', function ( assert ) { var uri = new mw.Uri( 'http://search.example.com/?q=uri' ); assert.deepEqual( @@ -264,7 +265,7 @@ } ); - QUnit.test( '.clone()', 6, function ( assert ) { + QUnit.test( '.clone()', function ( assert ) { var original, clone; original = new mw.Uri( 'http://foo.example.org/index.php?one=1&two=2' ); @@ -284,11 +285,11 @@ assert.deepEqual( original.query, { one: '1', two: '2' }, - 'Properties is deep cloned (bug 37708)' + 'Properties is deep cloned (T39708)' ); } ); - QUnit.test( '.toString() after query manipulation', 8, function ( assert ) { + QUnit.test( '.toString() after query manipulation', function ( assert ) { var uri; uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', { @@ -327,7 +328,7 @@ assert.equal( uri.toString(), 'http://www.example.com/dir/', 'empty array value is ommitted' ); } ); - QUnit.test( 'Variable defaultUri', 2, function ( assert ) { + QUnit.test( 'Variable defaultUri', function ( assert ) { var uri, href = 'http://example.org/w/index.php#here', UriClass = mw.UriRelative( function () { @@ -387,7 +388,7 @@ ); } ); - QUnit.test( 'Advanced URL', 11, function ( assert ) { + QUnit.test( 'Advanced URL', function ( assert ) { var uri, queryString, relativePath; uri = new mw.Uri( 'http://auth@www.example.com:81/dir/dir.2/index.htm?q1=0&&test1&test2=value+%28escaped%29#top' ); @@ -434,7 +435,7 @@ assert.ok( relativePath.indexOf( uri.fragment ) >= 0, 'fragment in relative path' ); } ); - QUnit.test( 'Parse a uri with an @ symbol in the path and query', 1, function ( assert ) { + QUnit.test( 'Parse a uri with an @ symbol in the path and query', function ( assert ) { var uri = new mw.Uri( 'http://www.example.com/test@test?x=@uri&y@=uri&z@=@' ); assert.deepEqual( @@ -464,7 +465,7 @@ ); } ); - QUnit.test( 'Handle protocol-relative URLs', 5, function ( assert ) { + QUnit.test( 'Handle protocol-relative URLs', function ( assert ) { var UriRel, uri; UriRel = mw.UriRelative( 'glork://en.wiki.local/foo.php' ); @@ -485,7 +486,7 @@ assert.equal( uri.toString(), 'http://en.wiki.local/foo.com', 'handle absolute paths by supplying host from document in strict mode' ); } ); - QUnit.test( 'bug 35658', 2, function ( assert ) { + QUnit.test( 'T37658', function ( assert ) { var testProtocol, testServer, testPort, testPath, UriClass, uri, href; testProtocol = 'https://';