[ADF-5362] - enabiling properties refresh on ADW/ACA (#6952)

This commit is contained in:
Vito
2021-04-27 12:15:48 +01:00
committed by GitHub
parent 672891e21b
commit 431f273b07
2 changed files with 26 additions and 0 deletions

View File

@@ -204,6 +204,29 @@ describe('ContentMetadataComponent', () => {
expect(contentMetadataService.openConfirmDialog).toHaveBeenCalledWith({nodeType: 'ft:poppoli'});
expect(nodesApiService.updateNode).toHaveBeenCalled();
}));
it('should retrigger the load of the properties when the content type has changed', fakeAsync(() => {
component.editable = true;
const property = <CardViewBaseItemModel> { key: 'nodeType', value: 'ft:sbiruli' };
const expectedNode = Object.assign({}, node, { nodeType: 'ft:sbiruli' });
spyOn(contentMetadataService, 'openConfirmDialog').and.returnValue(of(true));
spyOn(updateService, 'updateNodeAspect');
spyOn(nodesApiService, 'updateNode').and.callFake(() => {
return of(expectedNode);
});
updateService.update(property, 'ft:poppoli');
tick(600);
fixture.detectChanges();
tick(100);
const saveButton = fixture.debugElement.query(By.css('[data-automation-id="save-metadata"]'));
saveButton.nativeElement.click();
tick(100);
expect(component.node).toEqual(expectedNode);
expect(updateService.updateNodeAspect).toHaveBeenCalledWith(expectedNode);
}));
});
describe('Reseting', () => {

View File

@@ -208,6 +208,9 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
}))
.subscribe((updatedNode) => {
if (updatedNode) {
if (this.hasContentTypeChanged(this.changedProperties)) {
this.cardViewUpdateService.updateNodeAspect(this.node);
}
this.revertChanges();
Object.assign(this.node, updatedNode);
this.alfrescoApiService.nodeUpdated.next(this.node);