All files / app/pipe css-url.pipe.ts

54.54% Statements 6/11
53.84% Branches 7/13
100% Functions 2/2
50% Lines 4/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 2377x             77x     2x       1x                
import { Pipe, PipeTransform } from '@angular/core';
import { ProxyService } from '../service/api/proxy.service';
 
@Pipe({
    name: 'cssUrl',
    pure: true
})
export class CssUrlPipe implements PipeTransform {
 
  constructor(
    private proxy: ProxyService,
  ) { }
 
  transform(url: string | null, skip = ''): string | null {
    Eif (!url) return '';
    url = url.trim();
    skip = skip.trim();
    if (!url || url === skip || this.proxy.isProxied(url) === skip) return '';
    return `url("${url}")`;
  }
 
}