} ) );
$.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, {
} );
} );
- 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', {
} );
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,
},
'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',
);
} );
- 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();
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' );
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(
} );
- 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' );
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', {
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 () {
);
} );
- 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' );
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(
);
} );
- 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' );
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://';