All files / src/components/zd-progress progress.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 9/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 48 49 50 51 52 53 54 55 56 57 58 59 6093x             93x       2x         2x         2x         2x         2x         2x         2x                                    
import { ComponentRender } from '../zd-component/component-render';
import { IComponentRender } from '../zd-component/interfaces';
import { IProgress } from './interfaces';
 
/**
 * Base class for Progress component
 */
export class Progress extends ComponentRender implements IProgress {
	/**
	 * Set component's background color
	 */
	public backgroundColor = 'primary';
 
	/**
	 * Set component's background opacity
	 */
	public backgroundOpacity = '0.5';
 
	/**
	 * Defines the value color
	 */
	public color = 'primary';
 
	/**
	 * Sets the height for the component
	 */
	public height: number | string = 4;
 
	/**
	 * Animates the component constantly
	 */
	public indeterminate = false;
 
	/**
	 * Render components on the progress component
	 */
	public centerSlot: IComponentRender[] = [];
 
	/**
	 * The percentage value for current progress
	 */
	public value: number | string = 0;
 
	/* istanbul ignore next */
	/**
	 * Create a new Progress
	 * @param props Progress definition
	 */
	constructor(props: IProgress) {
		super(props);
		this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
		this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
		this.color = this.getInitValue('color', props.color, this.color);
		this.height = this.getInitValue('height', props.height, this.height);
		this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
		this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
		this.value = this.getInitValue('value', props.value, this.value);
	}
}