All files / src/ui/commands ve.ui.IndentationCommand.js

88.88% Statements 8/9
50% Branches 1/2
100% Functions 2/2
88.88% Lines 8/9

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 47                                1x   2x               1x             1x   1x     1x         1x   1x  
/*!
 * VisualEditor UserInterface IndentationCommand class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * UserInterface indentation command.
 *
 * @class
 * @extends ve.ui.Command
 *
 * @constructor
 * @param {string} name
 * @param {string} method
 */
ve.ui.IndentationCommand = function VeUiIndentationCommand( name, method ) {
	// Parent constructor
	ve.ui.IndentationCommand.super.call(
		this, name, 'indentation', method,
		{ supportedSelections: [ 'linear' ] }
	);
};
 
/* Inheritance */
 
OO.inheritClass( ve.ui.IndentationCommand, ve.ui.Command );
 
/* Methods */
 
/**
 * @inheritdoc
 */
ve.ui.IndentationCommand.prototype.isExecutable = function ( fragment ) {
	// Parent method
	Iif ( !ve.ui.IndentationCommand.super.prototype.isExecutable.apply( this, arguments ) ) {
		return false;
	}
	return fragment.hasMatchingAncestor( 'listItem' );
};
 
/* Registration */
 
ve.ui.commandRegistry.register( new ve.ui.IndentationCommand( 'indent', 'increase' ) );
 
ve.ui.commandRegistry.register( new ve.ui.IndentationCommand( 'outdent', 'decrease' ) );