All files / src/lib/wvr-manifest/wvr-manifest-entry wvr-manifest-entry.component.ts

88.89% Statements 8/9
50% Branches 1/2
100% Functions 2/2
87.5% Lines 7/8

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                    1x                                 11x 11x           8x 8x 8x 8x              
import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
import { ComponentRegistryService } from '../../core/component-registry.service';
import { WvrBaseComponent } from '../../shared/wvr-base.component';
import { WvrManifestComponent } from '../wvr-manifest.component';
 
@Component({
  selector: 'wvr-manifest-entry-component',
  template: '',
  changeDetection: ChangeDetectionStrategy.Default
})
export class WvrManifestEntryComponent implements OnInit {
 
  @Input() name;
 
  @Input() description;
 
  @Input() methods;
 
  @Input() path;
 
  @Input() options;
 
  @Input() mappingStrategy;
 
  private parent: WvrManifestComponent;
 
  constructor(
    private readonly eRef: ElementRef<HTMLElement>,
    private readonly componentRegistry: ComponentRegistryService<WvrBaseComponent>
  ) {
 
  }
 
  ngOnInit(): void {
    const parentElem = this.eRef.nativeElement.closest('wvre-manifest, wvr-manifest-component');
    Eif (parentElem) {
      this.parent = this.componentRegistry.getComponentByElement(parentElem as HTMLElement) as WvrManifestComponent;
      this.parent.addEntry(this);
    } else {
      console.warn(`WvrManifestEntryComponent ${this.name} is not contained with a WvrManifestComponent`);
    }
  }
 
}