]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { HttpClientTestingModule } from '@angular/common/http/testing'; |
2 | import { ComponentFixture, TestBed } from '@angular/core/testing'; | |
3 | import { ReactiveFormsModule } from '@angular/forms'; | |
4 | import { RouterTestingModule } from '@angular/router/testing'; | |
5 | ||
11fdf7f2 | 6 | import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; |
494da23a | 7 | import { ToastrModule } from 'ngx-toastr'; |
11fdf7f2 TL |
8 | |
9 | import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; | |
10 | import { ApiModule } from '../../../shared/api/api.module'; | |
11 | import { ComponentsModule } from '../../../shared/components/components.module'; | |
92f5a8d4 | 12 | import { PipesModule } from '../../../shared/pipes/pipes.module'; |
11fdf7f2 | 13 | import { AuthStorageService } from '../../../shared/services/auth-storage.service'; |
11fdf7f2 TL |
14 | import { RbdSnapshotFormComponent } from './rbd-snapshot-form.component'; |
15 | ||
16 | describe('RbdSnapshotFormComponent', () => { | |
17 | let component: RbdSnapshotFormComponent; | |
18 | let fixture: ComponentFixture<RbdSnapshotFormComponent>; | |
19 | ||
20 | configureTestBed({ | |
21 | imports: [ | |
22 | ReactiveFormsModule, | |
23 | ComponentsModule, | |
92f5a8d4 | 24 | PipesModule, |
11fdf7f2 | 25 | HttpClientTestingModule, |
11fdf7f2 | 26 | ApiModule, |
494da23a | 27 | ToastrModule.forRoot(), |
11fdf7f2 TL |
28 | RouterTestingModule |
29 | ], | |
30 | declarations: [RbdSnapshotFormComponent], | |
31 | providers: [BsModalRef, BsModalService, AuthStorageService, i18nProviders] | |
32 | }); | |
33 | ||
34 | beforeEach(() => { | |
35 | fixture = TestBed.createComponent(RbdSnapshotFormComponent); | |
36 | component = fixture.componentInstance; | |
11fdf7f2 TL |
37 | }); |
38 | ||
39 | it('should create', () => { | |
40 | expect(component).toBeTruthy(); | |
41 | }); | |
92f5a8d4 TL |
42 | |
43 | it('should show "Create" text', () => { | |
44 | fixture.detectChanges(); | |
45 | ||
46 | const header = fixture.debugElement.nativeElement.querySelector('h4'); | |
47 | expect(header.textContent).toBe('Create RBD Snapshot'); | |
48 | ||
49 | const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button'); | |
50 | expect(button.textContent).toBe('Create RBD Snapshot'); | |
51 | }); | |
52 | ||
53 | it('should show "Rename" text', () => { | |
54 | component.setEditing(); | |
55 | ||
56 | fixture.detectChanges(); | |
57 | ||
58 | const header = fixture.debugElement.nativeElement.querySelector('h4'); | |
59 | expect(header.textContent).toBe('Rename RBD Snapshot'); | |
60 | ||
61 | const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button'); | |
62 | expect(button.textContent).toBe('Rename RBD Snapshot'); | |
63 | }); | |
11fdf7f2 | 64 | }); |