All files Section.js

31.25% Statements 5/16
0% Branches 0/6
0% Functions 0/2
31.25% Lines 5/16

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 36 37 38 39 40 41 42 43 44 45 46  1x 1x 1x                                               1x                                 1x  
var
	mfExtend = require( './mfExtend' ),
	icons = require( './icons' ),
	View = require( './View' );
 
/**
 * Builds a section of a page
 * @class Section
 * @extends View
 *
 * @param {Object} options Configuration options
 */
function Section( options ) {
	var self = this;
	options.tag = 'h' + options.level;
	this.line = options.line;
	this.text = options.text;
	this.hasReferences = options.hasReferences || false;
	this.id = options.id || null;
	this.anchor = options.anchor;
	this.children = [];
	( options.children || [] ).forEach( function ( section ) {
		self.children.push( new Section( section ) );
	} );
	View.call( this, options );
}
 
mfExtend( Section, View, {
	template: mw.template.get( 'mobile.startup', 'Section.hogan' ),
	/**
	 * @memberof Section
	 * @instance
	 * @mixes View#defaults
	 * @property {Object} defaults Default options hash.
	 * @property {string} defaults.text Section text.
	 * @property {string} defaults.spinner HTML of the spinner icon.
	 */
	defaults: {
		line: undefined,
		text: '',
		spinner: icons.spinner().toHtmlString()
	}
} );
 
module.exports = Section;