[ADF-4522] Metadata value is not rolled back upon error (#5550)

* * initial commit

* * removed breaking change

* * fixed ts

* * fixed minor changes

* * fixed changes

* * minor changes

* * fixed unit test

* * docs added

* * fixed date clear problem

* * fixed unit test
This commit is contained in:
dhrn
2020-03-17 16:17:08 +05:30
committed by GitHub
parent becf45d150
commit d720d36670
18 changed files with 191 additions and 65 deletions

View File

@@ -147,12 +147,10 @@ describe('ContentMetadataComponent', () => {
expect(logService.error).toHaveBeenCalledWith(new Error('My bad'));
});
it('should raise error message and reload the properties', (done) => {
spyOn(contentMetadataService, 'getBasicProperties');
it('should raise error message', (done) => {
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' };
const sub = contentMetadataService.error.subscribe((err) => {
expect(contentMetadataService.getBasicProperties).toHaveBeenCalledWith(node);
expect(err.statusCode).toBe(0);
expect(err.message).toBe('METADATA.ERRORS.GENERIC');
sub.unsubscribe();

View File

@@ -94,7 +94,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
switchMap((changes) =>
this.saveNode(changes).pipe(
catchError((err) => {
this.loadProperties(this.node);
this.cardViewUpdateService.updateElement(changes.target);
this.handleUpdateError(err);
return of(null);
})