mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
This reverts commit 69b73c8490.
This commit is contained in:
+4
-29
@@ -424,10 +424,9 @@ describe('ProcessListCloudComponent', () => {
|
|||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
component.ngAfterContentInit();
|
|
||||||
component.appName = appName.currentValue;
|
component.appName = appName.currentValue;
|
||||||
component.reload();
|
component.ngOnChanges({ appName });
|
||||||
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should shown columns selector', () => {
|
it('should shown columns selector', () => {
|
||||||
@@ -759,9 +758,9 @@ describe('ProcessListCloudComponent', () => {
|
|||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
component.ngAfterContentInit();
|
|
||||||
component.appName = appName.currentValue;
|
component.appName = appName.currentValue;
|
||||||
component.reload();
|
component.ngOnChanges({ appName });
|
||||||
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should shown columns selector', () => {
|
it('should shown columns selector', () => {
|
||||||
@@ -955,30 +954,6 @@ describe('ProcessListCloudComponent', () => {
|
|||||||
component.resetPagination();
|
component.resetPagination();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call loadPreferencesAndInitialize when appName changes', () => {
|
|
||||||
spyOn(preferencesService, 'getPreferences').and.returnValue(of({}));
|
|
||||||
|
|
||||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
|
||||||
spyOn(component as any, 'createDatatableSchema');
|
|
||||||
spyOn(component as any, 'createColumns');
|
|
||||||
|
|
||||||
const appName = new SimpleChange('old-app-name', 'new-app-name', false);
|
|
||||||
component.ngOnChanges({ appName });
|
|
||||||
|
|
||||||
expect(preferencesService.getPreferences).toHaveBeenCalledWith('new-app-name');
|
|
||||||
expect((component as any).createDatatableSchema).toHaveBeenCalled();
|
|
||||||
expect((component as any).createColumns).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not call loadPreferencesAndInitialize when appName does not change', () => {
|
|
||||||
spyOn(preferencesService, 'getPreferences');
|
|
||||||
|
|
||||||
const status = new SimpleChange('old-status', 'new-status', false);
|
|
||||||
component.ngOnChanges({ status });
|
|
||||||
|
|
||||||
expect(preferencesService.getPreferences).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -397,12 +397,8 @@ export class ProcessListCloudComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
this.loadPreferencesAndInitialize(this.appName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadPreferencesAndInitialize(appName: string): void {
|
|
||||||
this.cloudPreferenceService
|
this.cloudPreferenceService
|
||||||
.getPreferences(appName)
|
.getPreferences(this.appName)
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((preferences) => {
|
map((preferences) => {
|
||||||
@@ -445,19 +441,13 @@ export class ProcessListCloudComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.createDatatableSchema();
|
this.createDatatableSchema();
|
||||||
this.createColumns();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (this.isPropertyChanged(changes, 'sorting')) {
|
if (this.isPropertyChanged(changes, 'sorting')) {
|
||||||
this.formatSorting(changes['sorting'].currentValue);
|
this.formatSorting(changes['sorting'].currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes['appName']) {
|
|
||||||
this.loadPreferencesAndInitialize(changes['appName'].currentValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isAnyPropertyChanged(changes)) {
|
if (this.isAnyPropertyChanged(changes)) {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user