/**
* Get the link to a page name (relative to `wgServer`),
*
- * @param {string} str Page name
+ * @param {string|null} [str=wgPageName] Page name
* @param {Object} [params] A mapping of query parameter names to values,
* e.g. `{ action: 'edit' }`
* @return {string} Url of the page with name of `str`
} );
} );
- QUnit.test( 'getUrl', 4, function ( assert ) {
+ QUnit.test( 'getUrl', 5, function ( assert ) {
// Not part of startUp module
mw.config.set( 'wgArticlePath', '/wiki/$1' );
mw.config.set( 'wgPageName', 'Foobar' );
href = mw.util.getUrl();
assert.equal( href, '/wiki/Foobar', 'default title' );
+ href = mw.util.getUrl( null, { action: 'edit' } );
+ assert.equal( href, '/wiki/Foobar?action=edit', 'default title with query string' );
+
href = mw.util.getUrl( 'Sandbox', { action: 'edit' } );
assert.equal( href, '/wiki/Sandbox?action=edit', 'simple title with query string' );
} );