All files / src/app/extensions/tacton/pages/configure/tacton-configure-navigation tacton-configure-navigation.component.ts

83.33% Statements 10/12
75% Branches 6/8
66.66% Functions 4/6
80% Lines 8/10

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 421x 1x   1x   1x               1x     2x     2x                                     2x      
import { DOCUMENT } from '@angular/common';
import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
 
import { TactonFacade } from '../../../facades/tacton.facade';
import { TactonNavigationTree } from '../../../models/tacton-navigation-tree/tacton-navigation-tree.model';
 
@Component({
  selector: 'ish-tacton-configure-navigation',
  templateUrl: './tacton-configure-navigation.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TactonConfigureNavigationComponent implements OnInit {
  tree$: Observable<TactonNavigationTree>;
 
  constructor(private tactonFacade: TactonFacade, @Inject(DOCUMENT) private document: Document) {}
 
  ngOnInit() {
    this.tree$ = this.tactonFacade.configurationTree$;
  }
 
  changeStep(step: string) {
    this.tactonFacade.changeConfigurationStep(step);
  }
 
  /**
   * scroll anchor smoothly into view
   *
   * @see https://stackoverflow.com/questions/46658522/how-to-smooth-scroll-to-page-anchor-in-angular-4-without-plugins-properly/51400379#51400379
   */
  scrollIntoView(id: string) {
    this.document
      .querySelector(`#anchor-${id}`)
      ?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
  }
 
  isActive$(name: string) {
    return this.tactonFacade.currentGroup$.pipe(map(current => current === name));
  }
}