show the first bit of the new redirect page.
* (bug 5800) Added $formCallback as a parameter to the hook
EditPage::showEditForm:initial
+* (bug 29723) mw.util.wikiGetlink() now defaults to wgPageName.
=== Bug fixes in 1.19 ===
* (bug 28868) Show total pages in the subtitle of an image on the
* @return string Location for a page with name of 'str' or boolean false on error.
*/
'wikiGetlink' : function( str ) {
-
- return mw.config.get( 'wgArticlePath' ).replace( '$1', this.wikiUrlencode( str ) );
+ return mw.config.get( 'wgArticlePath' ).replace( '$1',
+ this.wikiUrlencode( str || mw.config.get( 'wgPageName' ) ) );
},
/**
});
test( 'wikiGetlink', function() {
- expect(2);
+ expect(3);
// Not part of startUp module
mw.config.set( 'wgArticlePath', '/wiki/$1' );
+ mw.config.set( 'wgPageName', 'Foobar' );
var hrefA = mw.util.wikiGetlink( 'Sandbox' );
equal( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' );
var hrefB = mw.util.wikiGetlink( '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"' );
+
+ var hrefC = mw.util.wikiGetlink();
+ equal( hrefC, '/wiki/Foobar', 'Default title; Get link for current page ("Foobar")' );
});
test( 'wikiScript', function() {