Skip to content

Commit 4b8d14b

Browse files
committed
test(visible): coverage
1 parent bdb2164 commit 4b8d14b

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

projects/coreui-angular/src/lib/utilities/visible.directive.spec.ts

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { Component, DebugElement, input, TemplateRef, ViewContainerRef } from '@angular/core';
3+
import { By } from '@angular/platform-browser';
14
import { VisibleDirective } from './visible.directive';
2-
import { TestBed } from '@angular/core/testing';
3-
import { TemplateRef, ViewContainerRef } from '@angular/core';
5+
6+
@Component({
7+
imports: [VisibleDirective],
8+
template: '<ng-template [cVisible]="visible()">Test Node</ng-template>'
9+
})
10+
class TestComponent {
11+
readonly visible = input(true);
12+
}
413

514
describe('VisibleDirective', () => {
15+
let component: TestComponent;
16+
let fixture: ComponentFixture<TestComponent>;
17+
let debugElement: DebugElement;
18+
619
beforeEach(() => {
720
TestBed.configureTestingModule({
21+
imports: [TestComponent],
822
providers: [TemplateRef, ViewContainerRef]
9-
});
23+
}).compileComponents();
24+
25+
fixture = TestBed.createComponent(TestComponent);
26+
component = fixture.componentInstance;
27+
debugElement = fixture.debugElement.query(By.directive(VisibleDirective));
28+
fixture.detectChanges();
1029
});
30+
1131
it('should create an instance', () => {
1232
TestBed.runInInjectionContext(() => {
1333
const directive = new VisibleDirective();

0 commit comments

Comments
 (0)