All files / componenets/md-reference md-reference.component.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7

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                                1x 1x   1x   1x         1x   1x   1x    
import { ChangeDetectionStrategy, Component, inject, SecurityContext } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { Store } from '@ngrx/store';
import { map } from 'rxjs';
 
import { DOCUMENTATION_ENVIRONMENT } from '../../interfaces/environment.interface';
import { IMdFilesState } from '../../modules/md-files/md-files.interface';
import { mdFilesSelector } from '../../modules/md-files/md-files.selectors';
 
@Component({
  selector: 'app-documentation-md-reference',
  templateUrl: './md-reference.component.html',
  styleUrls: ['./md-reference.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: false,
})
export class AppDocMarkdownReferenceComponent {
  private readonly store = inject(Store<IMdFilesState>);
 
  private readonly sanitizer = inject(DomSanitizer);
 
  private readonly env = inject(DOCUMENTATION_ENVIRONMENT);
 
  /**
   * Selected markdown file path.
   */
  public readonly filePath$ = this.store
    .select(mdFilesSelector.filePath)
    .pipe(map(filePath => this.sanitizer.sanitize(SecurityContext.HTML, filePath)));
 
  public readonly useEmoji = !this.env.testing;
}