All files / sp-modal ViewModel.js

100% Statements 2/2
50% Branches 1/2
100% Functions 1/1
100% Lines 2/2

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 48 49 50 51 52 53 54                                    2x 2x                                                                    
import DefineMap from 'can-define/map/map';
import {ActionList} from '../util/actions/Action';
 
/**
 * @module sp-modal/ViewModel
 *
 * @description A `<sp-modal />` component's ViewModel
 */
export default DefineMap.extend('ModalDialog', {
    /** @lends sp-modal/ViewModel.prototype */
    /**
     * Whether or not this modal is currently active. The default is `false`
     * @type {Boolean}
     */
    active: {
        default: false, 
        type: 'boolean',
        set (active) {
            this.dispatch(active ? 'show' : 'hide', [this]);
            return active;
        }
    },
    /**
     * Whether or not to use a custom body content for the modal. The default is `false`.
     * This overrides the title property and modal-body divs displayed by displaying
     * only the content passed to the `<sp-modal></sp-modal>` component
     * @type {HTMLBoolean}
     * 
     */
    custom: {default: false, type: 'htmlbool'},
    /**
     * Option to add additional class to the modal (modal-sm , modal-lg etc.)
     * @type {String}
     * 
     */
    className: {type: 'string'},
    /**
     * The title displayed in the modal header
     * @type {String}
     * 
     */
    title: {type: 'string'},
    /**
     * Whether or not to display this modals backdrop. The default is `true`.
     * @type {Boolean}
     * 
     */
    backdrop: {default: true, type: 'boolean'},
    /**
     * Actions to display in this modal
     * @type {util/actions/Action[]}
     */
    actions: ActionList
});