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
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+
});
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)