[ACS-5752] fixed incorrect info drawer properties update (#3492)

This commit is contained in:
Mykyta Maliarchuk 2023-10-25 16:13:38 +02:00 committed by GitHub
parent b25a3ad9d8
commit 02f581e4c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -82,7 +82,7 @@ describe('LibraryMetadataFormComponent', () => {
expect(component.form.value).toEqual(siteEntryModel); expect(component.form.value).toEqual(siteEntryModel);
}); });
it('should update form data when node data changes', () => { it('should update form data and properties when node data changes', () => {
const newSiteEntryModel = { const newSiteEntryModel = {
title: 'libraryTitle2', title: 'libraryTitle2',
description: 'description2', description: 'description2',
@ -93,10 +93,12 @@ describe('LibraryMetadataFormComponent', () => {
component.toggleEdit(); component.toggleEdit();
expect(component.form.value).toEqual(siteEntryModel); expect(component.form.value).toEqual(siteEntryModel);
expect(component.canUpdateLibrary).toBeFalse();
component.node = { component.node = {
entry: { entry: {
id: 'libraryId', id: 'libraryId',
role: 'SiteManager',
...newSiteEntryModel ...newSiteEntryModel
} as Site } as Site
}; };
@ -104,6 +106,7 @@ describe('LibraryMetadataFormComponent', () => {
component.ngOnChanges(); component.ngOnChanges();
expect(component.form.value).toEqual(newSiteEntryModel); expect(component.form.value).toEqual(newSiteEntryModel);
expect(component.canUpdateLibrary).toBeTrue();
}); });
it('should assign form value to node entry if updating of form is finished with success', () => { it('should assign form value to node entry if updating of form is finished with success', () => {

View File

@ -186,6 +186,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
ngOnChanges() { ngOnChanges() {
this.updateForm(this.node); this.updateForm(this.node);
this.canUpdateLibrary = this.node?.entry?.role === 'SiteManager';
} }
update() { update() {