import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { of } from 'rxjs';
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
import { configureTestBed } from '../../../../testing/unit-test-helper';
import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component';
-import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
-import { SummaryService } from '../../../shared/services/summary.service';
import { SharedModule } from '../../../shared/shared.module';
import { NfsFormClientComponent } from '../nfs-form-client/nfs-form-client.component';
import { NfsFormComponent } from './nfs-form.component';
{
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ cluster_id: undefined, export_id: undefined })
- },
- SummaryService,
- CephReleaseNamePipe
+ }
]
},
[LoadingPanelComponent]
);
beforeEach(() => {
- const summaryService = TestBed.inject(SummaryService);
- spyOn(summaryService, 'refresh').and.callFake(() => true);
- spyOn(summaryService, 'subscribeOnce').and.callFake(() =>
- of({
- version: 'master'
- })
- );
-
fixture = TestBed.createComponent(NfsFormComponent);
component = fixture.componentInstance;
httpTesting = TestBed.inject(HttpTestingController);
transportTCP: true,
transportUDP: true
});
+ expect(component.nfsForm.get('cluster_id').disabled).toBeFalsy();
});
it('should prepare data when selecting an cluster', () => {
expect(component.nfsForm.getValue('daemons')).toEqual([]);
});
+ it('should not allow changing cluster in edit mode', () => {
+ component.isEdit = true;
+ component.ngOnInit();
+ expect(component.nfsForm.get('cluster_id').disabled).toBeTruthy();
+ });
+
describe('should submit request', () => {
beforeEach(() => {
component.nfsForm.patchValue({