Skip to content

Commit

Permalink
[ACS-8824] The user cannot edit node properties after failing... (#10420
Browse files Browse the repository at this point in the history
)

* [ACS-8824] The user cannot edit node properties after failing to change node name with special characters

* [ACS-8824] fix formatting
  • Loading branch information
nikita-web-ua authored Dec 16, 2024
1 parent 70c5904 commit 4ab3040
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,27 @@ describe('ContentMetadataComponent', () => {
flush();
}));

it('should revert changes on unsuccessful save', fakeAsync(() => {
component.readOnly = false;
const property = { key: 'properties.property-key', value: 'original-value' } as CardViewBaseItemModel;
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError(new Error('error message')));
spyOn(component, 'revertChanges').and.callThrough();
updateService.update(property, 'new-value');
tick(600);

fixture.detectChanges();
toggleEditModeForGeneralInfo();
tick(100);
clickOnGeneralInfoSave();
tick(100);

expect(component.revertChanges).toHaveBeenCalled();
expect(component.changedProperties).toEqual({});
expect(component.hasMetadataChanged).toBeFalse();
discardPeriodicTasks();
flush();
}));

it('should open the confirm dialog when content type is changed', fakeAsync(() => {
component.readOnly = false;
const property = { key: 'nodeType', value: 'ft:sbiruli' } as CardViewBaseItemModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit {
this.cardViewContentUpdateService.updateElement(this.targetProperty);
this.handleUpdateError(err);
this._saving = false;
this.revertChanges();
this.loadProperties(this.node);
return of(null);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class BasicPropertiesService {
key: 'properties.cm:name',
editable: true,
validators: [
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\:]')
]
}),
new CardViewTextItemModel({
Expand Down

0 comments on commit 4ab3040

Please sign in to comment.