All files / src/app/components/refresh-rate-selector refresh-rate-selector.component.ts

100% Statements 10/10
100% Branches 2/2
100% Functions 4/4
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                              154x   44x 44x           14183x       45x 45x       44x                 44x 110x    
import { Component, EventEmitter, OnInit, Output, Input } from '@angular/core';
import { SelectModule } from 'primeng/select';
import { FloatLabel } from 'primeng/floatlabel';
import { FormsModule } from '@angular/forms';
import { DurationOption } from '../../models/signals';
 
 
 
 
@Component({
  selector: 'app-refresh-rate-selector',
  imports: [SelectModule, FormsModule, FloatLabel],
  templateUrl: './refresh-rate-selector.component.html',
  styleUrl: './refresh-rate-selector.component.scss'
})
export class RefreshRateSelectorComponent implements OnInit {
  @Input() isResponseSlowerThanRefresh: boolean;
  @Input() isDisabled: boolean = false;
  @Output() selectionChanged = new EventEmitter<DurationOption>();
 
  refreshTimes: DurationOption[];
  private _refreshTime: DurationOption;
 
  public get refreshTime() {
    return this._refreshTime;
  }
 
  public set refreshTime(value: DurationOption) {
    this._refreshTime = value;
    this.selectionChanged.emit(value);
  }
 
  ngOnInit(): void {
    this.refreshTimes = [
      {label: "200ms", duration: 0.2},
      {label: "500ms", duration: 0.5},
      {label: "1s", duration: 1},
      {label: "2s", duration: 2},
      {label: "5s", duration: 5},
      {label: "10s", duration: 10}
    ];
 
    this.refreshTime = this.refreshTimes[3];
  }
}