All files / src/app/shared/components/confirm-dialog confirm-dialog.component.ts

90.9% Statements 10/11
80% Branches 8/10
100% Functions 2/2
90.9% Lines 10/11

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                  1x 2x   2x     1x 1x   1x       1x   1x     1x       1x        
import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ConfirmDialogData } from '../../interfaces/confirm-dialog.interfaces';
 
@Component({
  selector: 'tc-confirm-dialog',
  templateUrl: './confirm-dialog.component.html',
  styleUrls: ['./confirm-dialog.component.css']
})
export class ConfirmDialogComponent implements OnInit {
  showcancel = true;
 
  constructor(@Inject(MAT_DIALOG_DATA) public confirmdata: ConfirmDialogData) {}
 
  ngOnInit(): void {
    if ((typeof this.confirmdata.title === 'undefined') || (this.confirmdata.title.length === 0)) {
      this.confirmdata.title = 'Bitte bestätigen!';
    }
    if (
      (typeof this.confirmdata.confirmbuttonlabel === 'undefined') ||
      (this.confirmdata.confirmbuttonlabel.length === 0)
    ) {
      this.confirmdata.confirmbuttonlabel = 'Bestätigen';
    }
    Iif (!this.confirmdata.showcancel) {
      this.showcancel = false;
    }
    if (
      (typeof this.confirmdata.cancelbuttonlabel === 'undefined') ||
      (this.confirmdata.cancelbuttonlabel.length === 0)
    ) {
      this.confirmdata.cancelbuttonlabel = 'Abbrechen';
    }
  }
}