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

100% Statements 14/14
100% Branches 0/0
100% Functions 0/0
100% Lines 14/14

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8693x           93x       2x         2x   2x         2x         2x         2x         2x         2x         2x         2x         2x         2x                                              
import { ComponentRender } from '../zd-component/component-render';
import { ITooltip } from './interfaces';
 
/**
 * Base class for Tooltip component.
 */
export class Tooltip extends ComponentRender implements ITooltip {
	/**
	 * Aligns the component towards the bottom
	 */
	public bottom = false;
 
	/**
	 * Disables the tooltip
	 */
	public disabled = false;
 
	public label = '';
 
	/**
	 * Aligns the component towards the left
	 */
	public left = false;
 
	/**
	 * Sets the maximum width for the content
	 */
	public maxWidth?: number | string = undefined;
 
	/**
	 * Sets the minimum width for the content
	 */
	public minWidth?: number | string = undefined;
 
	/**
	 * Nudge the content
	 */
	public nudge: number | string = 10;
 
	/**
	 * Open the tooltip on activator click
	 */
	public openOnClick = false;
 
	/**
	 * Open the tooltip on activator focus
	 */
	public openOnFocus = true;
 
	/**
	 * Open the tooltip on activator hover
	 */
	public openOnHover = true;
 
	/**
	 * Nudge the content to the top
	 */
	public right = false;
 
	/**
	 * Nudge the content to the top
	 */
	public top = false;
 
	/* istanbul ignore next */
	/**
	 * Create a new Tooltip
	 * @param props Tooltip definition
	 */
	constructor(props: ITooltip) {
		super(props);
		this.bottom = this.getInitValue('bottom', props.bottom, this.bottom);
		this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
		this.left = this.getInitValue('left', props.left, this.left);
		this.label = this.getInitValue('label', props.label, this.label);
		this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
		this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
		this.nudge = this.getInitValue('nudge', props.nudge, this.nudge);
		this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
		this.openOnFocus = this.getInitValue('openOnFocus', props.openOnFocus, this.openOnFocus);
		this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
		this.right = this.getInitValue('right', props.right, this.right);
		this.top = this.getInitValue('top', props.top, this.top);
	}
}