All files / mobile.startup/mediaViewer overlay.js

63.63% Statements 7/11
100% Branches 0/0
0% Functions 0/2
63.63% Lines 7/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x 1x 1x 1x 1x 1x                                                         1x  
var m = require( '../moduleLoaderSingleton' ),
	promisedView = require( '../promisedView' ),
	util = require( '../util' ),
	header = require( '../headers' ).header,
	icons = require( '../icons' ),
	Overlay = require( '../Overlay' );
 
/**
 * Produce an overlay for mediaViewer
 *
 * @param {Object} options
 * @return {Overlay}
 */
function mediaViewerOverlay( options ) {
	var overlay = Overlay.make(
		{
			headers: [
				header( '', [], icons.cancel( 'gray' ) )
			],
			className: 'overlay media-viewer'
		},
		promisedView(
			util.Promise.all( [
				mw.loader.using( 'mobile.mediaViewer' )
			] ).then( () => {
				var ImageCarousel = m.require( 'mobile.mediaViewer' ).ImageCarousel;
				return new ImageCarousel( options );
			} )
		)
	);
 
	return overlay;
}
 
module.exports = mediaViewerOverlay;