# all files / src/mixins/ GroupWidget.js

90% Statements 9/10
100% Branches 2/2
100% Functions 2/2
90% Lines 9/10

    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
    48
    49

    1×

    9500×

    1×

    1×
    12660×

    12660×

    12660×
    3184×

    12660×

     /**
     * Mixin for OO.ui.Widget subclasses to provide OO.ui.mixin.GroupElement.
     *
     * Use together with OO.ui.mixin.ItemWidget to make disabled state inheritable.
     *
     * @private
     * @abstract
     * @class
     * @mixins OO.ui.mixin.GroupElement
     *
     * @constructor
     * @param {Object} [config] Configuration options
     */
    OO.ui.mixin.GroupWidget = function OoUiMixinGroupWidget( config ) {
    	// Mixin constructors
    	OO.ui.mixin.GroupElement.call( this, config );
    };

    /* Setup */

    OO.mixinClass( OO.ui.mixin.GroupWidget, OO.ui.mixin.GroupElement );

    /* Methods */

    /**
     * Set the disabled state of the widget.
     *
     * This will also update the disabled state of child widgets.
     *
     * @param {boolean} disabled Disable widget
     * @chainable
     */
    OO.ui.mixin.GroupWidget.prototype.setDisabled = function ( disabled ) {
    	var i, len;

    	// Parent method
    	// Note: Calling #setDisabled this way assumes this is mixed into an OO.ui.Widget
    	OO.ui.Widget.prototype.setDisabled.call( this, disabled );

    	// During construction, #setDisabled is called before the OO.ui.mixin.GroupElement constructor
    	if ( this.items ) {
    		for ( i = 0, len = this.items.length; i < len; i++ ) {
    			this.items[ i ].updateDisabled();
    		}
    	}

    	return this;
    };