Skip to content

Commit bf44bd0

Browse files
committed
refactor(template-id.directive): cleanup, add missing test
1 parent b0e31b1 commit bf44bd0

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { TemplateIdDirective } from './template-id.directive';
3+
import { TemplateRef } from '@angular/core';
4+
5+
describe('TemplateIdDirective', () => {
6+
beforeEach(() => {
7+
TestBed.configureTestingModule({
8+
providers: [TemplateRef],
9+
});
10+
});
11+
it('should create an instance', () => {
12+
TestBed.runInInjectionContext(() => {
13+
const directive = new TemplateIdDirective();
14+
expect(directive).toBeTruthy();
15+
});
16+
});
17+
});
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import { Directive, Input, TemplateRef } from '@angular/core';
1+
import { Directive, inject, Input, TemplateRef } from '@angular/core';
22

33
@Directive({
44
selector: '[cTemplateId]',
5-
standalone: true
5+
standalone: true,
66
})
77
export class TemplateIdDirective {
8+
public readonly templateRef = inject(TemplateRef);
89
@Input('cTemplateId') id!: string;
9-
10-
constructor(
11-
public templateRef: TemplateRef<any>
12-
) { }
1310
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy