diff --git a/lib/core/src/lib/app-config/app-config.service.ts b/lib/core/src/lib/app-config/app-config.service.ts index 56dd77fe64..4be1c40ae6 100644 --- a/lib/core/src/lib/app-config/app-config.service.ts +++ b/lib/core/src/lib/app-config/app-config.service.ts @@ -252,7 +252,7 @@ export class AppConfigService { * @returns auth config model */ get oauth2(): OauthConfigModel { - const config = this.get(AppConfigValues.OAUTHCONFIG, {}); + const config = this.get(AppConfigValues.OAUTHCONFIG, {}) ?? {}; const implicitFlow = config['implicitFlow'] === true || config['implicitFlow'] === 'true'; const silentLogin = config['silentLogin'] === true || config['silentLogin'] === 'true'; const codeFlow = config['codeFlow'] === true || config['codeFlow'] === 'true'; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html index f312fcbdc7..dc3c0d227e 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html @@ -24,7 +24,6 @@ [title]="field.tooltip" panelClass="adf-select-filter" [multiple]="field.hasMultipleValues" - [disabled]="field.readOnly" [required]="field.required" #select (keydown.escape)="select.close()" diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/file-viewer/file-viewer.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/file-viewer/file-viewer.widget.spec.ts index 0cf5163781..d324d7ff73 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/file-viewer/file-viewer.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/file-viewer/file-viewer.widget.spec.ts @@ -17,12 +17,11 @@ import { FileViewerWidgetComponent } from './file-viewer.widget'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormFieldModel, FormModel, FormService, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; describe('FileViewerWidgetComponent', () => { const fakeForm = new FormModel(); let widget: FileViewerWidgetComponent; - let formServiceStub: Partial; let fixture: ComponentFixture; const fakePngAnswer: any = { @@ -42,11 +41,9 @@ describe('FileViewerWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [NoopTranslateModule, NoopAuthModule, FileViewerWidgetComponent], - providers: [{ provide: FormService, useValue: formServiceStub }] + imports: [NoopTranslateModule, NoopAuthModule, FileViewerWidgetComponent] }); - formServiceStub = TestBed.inject(FormService); fixture = TestBed.createComponent(FileViewerWidgetComponent); widget = fixture.componentInstance; }); diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html index a591da9d68..ff6c6d1032 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html @@ -12,7 +12,7 @@ {{group.name}} - { component.reload(); }); - it('should call endpoint when a column visibility gets changed', () => { - spyOn(preferencesService, 'updatePreference').and.returnValue(of({})); - spyOn(processListCloudService, 'getProcessByRequest'); + it('should update preferences when a column visibility gets changed', () => { + const updatePreferenceSpy = spyOn(preferencesService, 'updatePreference').and.returnValue(of({})); + spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); component.ngAfterContentInit(); - spyOn(component, 'createDatatableSchema'); + const createDatatableSchemaSpy = spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; component.reload(); fixture.detectChanges(); @@ -544,7 +544,8 @@ describe('ProcessListCloudComponent', () => { fixture.detectChanges(); - expect(processListCloudService.getProcessByRequest).toHaveBeenCalledTimes(1); + expect(updatePreferenceSpy).toHaveBeenCalled(); + expect(createDatatableSchemaSpy).toHaveBeenCalled(); }); describe('component changes', () => { @@ -921,11 +922,11 @@ describe('ProcessListCloudComponent', () => { component.reload(); }); - it('should call endpoint when a column visibility gets changed', () => { - spyOn(preferencesService, 'updatePreference').and.returnValue(of({})); - spyOn(processListCloudService, 'fetchProcessList'); + it('should update preferences when a column visibility gets changed', () => { + const updatePreferenceSpy = spyOn(preferencesService, 'updatePreference').and.returnValue(of({})); + spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList)); component.ngAfterContentInit(); - spyOn(component, 'createDatatableSchema'); + const createDatatableSchemaSpy = spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; component.reload(); fixture.detectChanges(); @@ -934,7 +935,8 @@ describe('ProcessListCloudComponent', () => { fixture.detectChanges(); - expect(processListCloudService.fetchProcessList).toHaveBeenCalledTimes(1); + expect(updatePreferenceSpy).toHaveBeenCalled(); + expect(createDatatableSchemaSpy).toHaveBeenCalled(); }); describe('component changes', () => { @@ -1250,12 +1252,16 @@ describe('ProcessListCloudComponent', () => { describe('ProcessListCloudComponent: Injecting custom columns for task list - CustomTaskListComponent', () => { let fixtureCustom: ComponentFixture; let componentCustom: CustomTaskListComponent; + let processListCloudService: ProcessListCloudService; beforeEach(() => { TestBed.configureTestingModule({ imports: [CustomTaskListComponent], providers: [provideCloudPreferences()] }); + processListCloudService = TestBed.inject(ProcessListCloudService); + spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); + spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList)); fixtureCustom = TestBed.createComponent(CustomTaskListComponent); fixtureCustom.detectChanges(); componentCustom = fixtureCustom.componentInstance; @@ -1292,6 +1298,7 @@ describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTe } let fixtureEmpty: ComponentFixture; + let processListCloudService: ProcessListCloudService; const preferencesService = jasmine.createSpyObj('preferencesService', { getPreferences: of({}), updatePreference: of({}) @@ -1302,6 +1309,9 @@ describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTe imports: [NoopTranslateModule, CustomEmptyContentTemplateDirective, ProcessListCloudComponent, EmptyTemplateComponent], providers: [{ provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useValue: preferencesService }] }); + processListCloudService = TestBed.inject(ProcessListCloudService); + spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); + spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList)); fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent); fixtureEmpty.detectChanges(); }); diff --git a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts index 0e57a989f8..198c79c2bb 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts @@ -396,7 +396,7 @@ export class ProcessListCloudComponent } else { const requestNode = this.createRequestNode(); this.requestNode = requestNode; - return this.processListCloudService.getProcessByRequest(requestNode).pipe(); + return this.processListCloudService.getProcessByRequest(requestNode); } }), takeUntilDestroyed() diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts index 86946b7abf..e44cd0eed9 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts @@ -121,9 +121,9 @@ describe('TaskAssignmentFilterComponent', () => { it('should have floating labels when values are present', async () => { const inputLabelsNodes = await loader.getAllHarnesses(MatFormFieldHarness); - inputLabelsNodes.forEach(async (labelNode) => { + for (const labelNode of inputLabelsNodes) { expect(await labelNode.isLabelFloating()).toBeTruthy(); - }); + } }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts index 56947ef60a..5a1fd65101 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts @@ -238,9 +238,10 @@ describe('TaskListCloudComponent', () => { component.reload(); }); - it('should call endpoint when a column visibility gets changed', () => { + it('should update preferences when a column visibility gets changed', () => { + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); component.ngAfterContentInit(); - spyOn(component, 'createDatatableSchema'); + const createDatatableSchemaSpy = spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; component.reload(); fixture.detectChanges(); @@ -249,7 +250,8 @@ describe('TaskListCloudComponent', () => { fixture.detectChanges(); - expect(getTaskByRequestSpy).toHaveBeenCalledTimes(1); + expect(preferencesService.updatePreference).toHaveBeenCalled(); + expect(createDatatableSchemaSpy).toHaveBeenCalled(); }); describe('component changes', () => {