Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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', () => {
Expand Down
Expand Up @@ -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);
Expand Down