Skip to content

Commit bdb2164

Browse files
committed
test(shadow-on-scroll): coverage
1 parent 45c8171 commit bdb2164

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

projects/coreui-angular/src/lib/utilities/shadow-on-scroll.directive.spec.ts

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1-
import { ElementRef } from '@angular/core';
2-
import { TestBed } from '@angular/core/testing';
1+
import { Component, DebugElement, ElementRef } from '@angular/core';
2+
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { ShadowOnScrollDirective } from './shadow-on-scroll.directive';
4+
import { By } from '@angular/platform-browser';
5+
import { DOCUMENT } from '@angular/common';
6+
7+
@Component({
8+
imports: [ShadowOnScrollDirective],
9+
template: '<div cShadowOnScroll></div>'
10+
})
11+
class TestComponent {}
412

513
class MockElementRef extends ElementRef {}
614

715
describe('ShadowOnScrollDirective', () => {
16+
let component: TestComponent;
17+
let fixture: ComponentFixture<TestComponent>;
18+
let debugElement: DebugElement;
19+
let document: Document;
820

921
beforeEach(() => {
1022
TestBed.configureTestingModule({
11-
imports: [ShadowOnScrollDirective],
23+
imports: [TestComponent, ShadowOnScrollDirective],
1224
providers: [{ provide: ElementRef, useClass: MockElementRef }]
13-
});
25+
}).compileComponents();
26+
27+
fixture = TestBed.createComponent(TestComponent);
28+
document = TestBed.inject(DOCUMENT);
29+
component = fixture.componentInstance;
30+
debugElement = fixture.debugElement.query(By.directive(ShadowOnScrollDirective));
31+
fixture.detectChanges();
1432
});
1533

1634
it('should create an instance', () => {

0 commit comments

Comments
 (0)