]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; |
2 | import { RouterTestingModule } from '@angular/router/testing'; | |
3 | ||
4 | import { configureTestBed } from '~/testing/unit-test-helper'; | |
5 | import { CardComponent } from './card.component'; | |
6 | ||
7 | describe('CardComponent', () => { | |
8 | let component: CardComponent; | |
9 | let fixture: ComponentFixture<CardComponent>; | |
10 | ||
11 | configureTestBed({ | |
12 | imports: [RouterTestingModule], | |
13 | declarations: [CardComponent] | |
14 | }); | |
15 | ||
16 | beforeEach(() => { | |
17 | fixture = TestBed.createComponent(CardComponent); | |
18 | component = fixture.componentInstance; | |
19 | }); | |
20 | ||
21 | it('should create', () => { | |
22 | expect(component).toBeTruthy(); | |
23 | }); | |
24 | ||
25 | it('Setting cards title makes title visible', () => { | |
26 | const title = 'Card Title'; | |
27 | component.cardTitle = title; | |
28 | fixture.detectChanges(); | |
29 | const titleDiv = fixture.debugElement.nativeElement.querySelector('.card-title'); | |
30 | ||
31 | expect(titleDiv.textContent).toContain(title); | |
32 | }); | |
33 | }); |