Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45f9dc5

Browse filesBrowse files
committed
test(bg-color): css classes coverage
1 parent 5f16004 commit 45f9dc5
Copy full SHA for 45f9dc5

File tree

1 file changed

+30
-3
lines changed
Filter options

1 file changed

+30
-3
lines changed
+30-3Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1-
import { TestBed } from '@angular/core/testing';
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { BgColorDirective } from './bg-color.directive';
3+
import { Component, DebugElement } from '@angular/core';
4+
import { By } from '@angular/platform-browser';
5+
6+
@Component({
7+
imports: [BgColorDirective],
8+
template: '<div cBgColor="primary"></div>'
9+
})
10+
class TestComponent {}
311

412
describe('BgColorDirective', () => {
13+
let component: TestComponent;
14+
let fixture: ComponentFixture<TestComponent>;
15+
let debugElement: DebugElement;
16+
17+
beforeEach(() => {
18+
TestBed.configureTestingModule({
19+
imports: [TestComponent]
20+
}).compileComponents();
21+
22+
fixture = TestBed.createComponent(TestComponent);
23+
component = fixture.componentInstance;
24+
debugElement = fixture.debugElement.query(By.directive(BgColorDirective));
25+
fixture.detectChanges();
26+
});
27+
528
it('should create an instance', () => {
629
TestBed.runInInjectionContext(() => {
7-
const directive = new BgColorDirective();
8-
expect(directive).toBeTruthy();
30+
const directive = new BgColorDirective();
31+
expect(directive).toBeTruthy();
932
});
1033
});
34+
35+
it('should have css classes', () => {
36+
expect(debugElement.nativeElement).toHaveClass('bg-primary');
37+
});
1138
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.