import 'reflect-metadata'; import { ElementRef, } from '@angular/core'; import { SvgHrefDirective, } from './svg-href.directive'; describe('ngOnInit', () => { // tslint:disable-next-line test('It sets the href of the element using the correct namespace to the svgHref input', () => { const element = { nativeElement: { setAttributeNS: jest.fn(), }, } as ElementRef; const svgHrefDirective = new SvgHrefDirective( element, ); svgHrefDirective.svgHref = 'test'; svgHrefDirective.ngOnInit(); expect(element.nativeElement.setAttributeNS) .toHaveBeenCalledWith( 'http://www.w3.org/1999/xlink', 'href', svgHrefDirective.svgHref, ); }); });