refs #5063 fixed front test

This commit is contained in:
Alexandre Riera 2023-02-24 10:37:35 +01:00
parent afb14044cc
commit 6d6fa11da1
2 changed files with 5 additions and 8 deletions

View File

@ -92,10 +92,8 @@ class Controller extends Descriptor {
this.$.photo.setAttribute('src', newSrc);
this.$.photo.setAttribute('zoom-image', newZoomSrc);
if (this.item.isPhotoRequested) {
this.$http.patch(`Items/${this.item.id}`, {isPhotoRequested: false})
.then(() => this.item.isPhotoRequested = false);
}
if (this.item.isPhotoRequested)
this.$http.patch(`Items/${this.item.id}`, {isPhotoRequested: false});
}
getWarehouseName(warehouseFk) {

View File

@ -47,14 +47,13 @@ describe('vnItemDescriptor', () => {
describe('onUploadResponse()', () => {
it(`should change isPhotoRequested when a new photo is uploaded`, () => {
$httpBackend.expectPATCH(`Items/${item.id}`).respond();
controller.item = item;
controller.$rootScope = {imagePath: () => {}};
controller.$.photo = {setAttribute: () => {}};
controller.item = item;
$httpBackend.expectPATCH(`Items/${item.id}`).respond(200);
controller.onUploadResponse();
$httpBackend.flush();
expect(controller.item.isPhotoRequested).toEqual(false);
});
});
});