[ADF-2175] Document List requests are executed twice when opening the copy and move dialog (#2960)

* [ADF-2175] Document List requests are executed twice when opening the dialog

fixed bug

* [ADF-2175] added unit tests for the change & refactored initial code
This commit is contained in:
suzanadirla
2018-02-20 15:59:12 +02:00
committed by Eugenio Romano
parent adb0b8df38
commit d731cc651c
2 changed files with 20 additions and 0 deletions

View File

@@ -1204,4 +1204,22 @@ describe('DocumentList', () => {
expect(documentList.reload).not.toHaveBeenCalled();
});
it('should NOT reload data on first call of onNgChanges', () => {
spyOn(documentList, 'reload').and.stub();
const firstChange = true;
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 10, firstChange) });
expect(documentList.reload).not.toHaveBeenCalled();
});
it('should reload data on NON-first calls of onNgChanges', () => {
spyOn(documentList, 'reload').and.stub();
const firstChange = true;
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 10, !firstChange) });
expect(documentList.reload).toHaveBeenCalled();
});
});