Merge "Move the article renderer in to the renderers property"

This commit is contained in:
jenkins-bot 2015-10-01 08:50:39 +00:00 committed by Gerrit Code Review
commit 486e34fb38
3 changed files with 10 additions and 4 deletions

View file

@ -564,6 +564,6 @@
} }
}; };
mw.popups.render.article = article; mw.popups.render.renderers.article = article;
} )( jQuery, mediaWiki ); } )( jQuery, mediaWiki );

View file

@ -54,6 +54,12 @@
*/ */
mw.popups.render.currentRequest = undefined; mw.popups.render.currentRequest = undefined;
/**
* Object to store all renderers
* @property {Object} renderers
*/
mw.popups.render.renderers = {};
/** /**
* Close all other popups and render the new one from the cache * Close all other popups and render the new one from the cache
* or by finding and calling the correct renderer * or by finding and calling the correct renderer
@ -104,7 +110,7 @@
.done( function () { .done( function () {
// TODO: check for link type and call correct renderer // TODO: check for link type and call correct renderer
// There is only one popup type right now so it isn't necessary // There is only one popup type right now so it isn't necessary
var cachePopup = mw.popups.render.article.init( link ); var cachePopup = mw.popups.render.renderers.article.init( link );
mw.popups.render.openTimer = mw.popups.render.wait( mw.popups.render.POPUP_DELAY - mw.popups.render.API_DELAY ); mw.popups.render.openTimer = mw.popups.render.wait( mw.popups.render.POPUP_DELAY - mw.popups.render.API_DELAY );

View file

@ -1,13 +1,13 @@
( function ( $, mw ) { ( function ( $, mw ) {
QUnit.module( 'ext.popups.renderer.article', QUnit.newMwEnvironment() ); QUnit.module( 'ext.popups.renderer.renderers.article', QUnit.newMwEnvironment() );
QUnit.test( 'render.article.getProcessedElements', function ( assert ) { QUnit.test( 'render.article.getProcessedElements', function ( assert ) {
QUnit.expect( 13 ); QUnit.expect( 13 );
function test( extract, title, expected, msg ) { function test( extract, title, expected, msg ) {
var $div = $( '<div>' ).append( var $div = $( '<div>' ).append(
mw.popups.render.article.getProcessedElements( extract, title ) mw.popups.render.renderers.article.getProcessedElements( extract, title )
); );
assert.equal( $div.html(), expected, msg ); assert.equal( $div.html(), expected, msg );
} }