]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.spec.ts
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / rbd-snapshot-form / rbd-snapshot-form.component.spec.ts
CommitLineData
11fdf7f2
TL
1import { HttpClientTestingModule } from '@angular/common/http/testing';
2import { ComponentFixture, TestBed } from '@angular/core/testing';
3import { ReactiveFormsModule } from '@angular/forms';
4import { RouterTestingModule } from '@angular/router/testing';
5
11fdf7f2 6import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
494da23a 7import { ToastrModule } from 'ngx-toastr';
11fdf7f2
TL
8
9import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
10import { ApiModule } from '../../../shared/api/api.module';
11import { ComponentsModule } from '../../../shared/components/components.module';
92f5a8d4 12import { PipesModule } from '../../../shared/pipes/pipes.module';
11fdf7f2 13import { AuthStorageService } from '../../../shared/services/auth-storage.service';
11fdf7f2
TL
14import { RbdSnapshotFormComponent } from './rbd-snapshot-form.component';
15
16describe('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});