Kamil Chmielowski
Web / Angular
Jasmine code coverage report for cv app.
You can contact with me by email: kamilchmielowski94@gmail.com or my page.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1x 9x 9x 9x 9x 9x 9x 9x 11x 11x 11x 20x 11x 11x 11x 4x 4x 4x 11x 242x 11x 11x | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Inject, OnInit } from '@angular/core';
import { ChildrenOutletContexts } from '@angular/router';
import { DOCUMENT } from '@angular/common';
import { SvgIconRegistryService } from 'angular-svg-icon';
import { TranslateService } from '@ngx-translate/core';
import { appIconsMap } from './app-icons-map';
import { fadeAnimation } from './directives/page-animation/page-animation';
import { Languages } from './components/header/change-lang/change-lang.component';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
animations: [fadeAnimation],
})
export class AppComponent implements OnInit {
@HostBinding('class.starting-app') private startingApp = true;
readonly defaultLang = Languages.en;
constructor(
private cdr: ChangeDetectorRef,
private contexts: ChildrenOutletContexts,
@Inject(DOCUMENT) private document: Document,
private registry: SvgIconRegistryService,
private translate: TranslateService,
) {}
ngOnInit() {
this.initTranslationsLang();
this.registerIcons();
this.disableTransitionsOnStartingApp();
}
protected getRouteAnimationData() {
return this.contexts.getContext('primary')?.route?.snapshot?.data?.['animation'];
}
private disableTransitionsOnStartingApp(): void {
this.document.body.classList.add('starting-app');
this.document.documentElement.classList.add('starting-app');
setTimeout(() => {
this.startingApp = false;
this.document.body.classList.remove('starting-app');
this.document.documentElement.classList.remove('starting-app');
}, 600);
}
private registerIcons(): void {
for (const [name, data] of appIconsMap.entries()) {
this.registry.addSvg(name, data);
}
}
private initTranslationsLang(): void {
this.translate.setDefaultLang(this.defaultLang);
this.translate.use(this.defaultLang);
}
}
|