// Core imports import { Component, DebugElement } from '@angular/core'; // Application imports import { PasswordToggleDirective } from '@app/auth/_directives/password-toggle.directive'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; @Component({ template: `
`, }) class TestComponent {} describe('PasswordToggleDirective', () => { let fixture: ComponentFixture; let des: DebugElement[]; beforeEach(() => { fixture = TestBed.configureTestingModule({ declarations: [PasswordToggleDirective, TestComponent], }).createComponent(TestComponent); fixture.detectChanges(); des = fixture.debugElement.queryAll(By.directive(PasswordToggleDirective)); }); it('should have one element with menu-toggle directive', () => { expect(des.length).toBe(1); }); });