All files / app/services/dom dom.service.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5

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        1x 36x     22x       1x       7x      
import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from '@angular/core';
 
@Injectable({ providedIn: 'root' })
export class DomService {
  constructor(@Inject(DOCUMENT) private document: Document) {}
 
  static remToPixels(rem: number): number {
    return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
  }
 
  isDesktop(): boolean {
    return this.getWindow().matchMedia('(min-width: 1024px)').matches;
  }
 
  getWindow(): Window {
    return this.document.defaultView!.window;
  }
}