mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5362] - enabiling properties refresh on ADW/ACA (#6952)
This commit is contained in:
@@ -204,6 +204,29 @@ describe('ContentMetadataComponent', () => {
|
|||||||
expect(contentMetadataService.openConfirmDialog).toHaveBeenCalledWith({nodeType: 'ft:poppoli'});
|
expect(contentMetadataService.openConfirmDialog).toHaveBeenCalledWith({nodeType: 'ft:poppoli'});
|
||||||
expect(nodesApiService.updateNode).toHaveBeenCalled();
|
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', () => {
|
describe('Reseting', () => {
|
||||||
|
@@ -208,6 +208,9 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}))
|
}))
|
||||||
.subscribe((updatedNode) => {
|
.subscribe((updatedNode) => {
|
||||||
if (updatedNode) {
|
if (updatedNode) {
|
||||||
|
if (this.hasContentTypeChanged(this.changedProperties)) {
|
||||||
|
this.cardViewUpdateService.updateNodeAspect(this.node);
|
||||||
|
}
|
||||||
this.revertChanges();
|
this.revertChanges();
|
||||||
Object.assign(this.node, updatedNode);
|
Object.assign(this.node, updatedNode);
|
||||||
this.alfrescoApiService.nodeUpdated.next(this.node);
|
this.alfrescoApiService.nodeUpdated.next(this.node);
|
||||||
|
Reference in New Issue
Block a user