Skip to content

Commit

Permalink
Fixing media merging #706
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed Sep 1, 2023
1 parent 7b7afc0 commit 442a9ab
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 118 deletions.
14 changes: 11 additions & 3 deletions src/frontend/app/ui/gallery/grid/grid.gallery.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('GalleryGridComponent', () => {
component.mediaGroups = [{name: 'equal 1', media: [phs[0], phs[1]]}];
component.mediaToRender = [{name: 'equal 1', media: [gPhs[0], gPhs[1]]}];
component.mergeNewPhotos();
expect(component.mediaToRender).toEqual([{name: 'equal 1', media: [gPhs[0], gPhs[1]]}]);
expect(component.mediaToRender).toEqual([{name: 'equal 1', media: [gPhs[0],gPhs[1]]}]);
/*-----------------------*/
component.mediaGroups = [{name: 'empty render', media: [phs[0], phs[1]]}];
component.mediaToRender = [];
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('GalleryGridComponent', () => {
component.mediaGroups = [{name: 'removed 2nd 2', media: [phs[0], phs[1]]}, {name: '2', media: [phs[2], phs[5]]}];
component.mediaToRender = [{name: 'removed 2nd 2', media: [gPhs[0], gPhs[1]]}, {name: '2', media: [gPhs[2], gPhs[5], gPhs[3], gPhs[4]]}];
component.mergeNewPhotos();
expect(component.mediaToRender).toEqual([{name: 'removed 2nd 2', media: [gPhs[0], gPhs[1]]}, {name: '2', media: [gPhs[2]]}]);
expect(component.mediaToRender).toEqual([{name: 'removed 2nd 2', media: [gPhs[0], gPhs[1]]}, {name: '2', media: [gPhs[2], gPhs[5]]}]);
/*-----------------------*/
component.mediaGroups = [{name: 'removed from 1st', media: [phs[0]]},{name: '2', media: [phs[2],phs[3],phs[4]]}];
component.mediaToRender = [{name: 'removed from 1st', media: [gPhs[0], gPhs[1]]},{name: '2', media: [gPhs[2], gPhs[3], gPhs[4]]}];
Expand All @@ -129,12 +129,20 @@ describe('GalleryGridComponent', () => {
component.mediaGroups = [{name: 'merged', media: [phs[0], phs[1],phs[2],phs[3]]}];
component.mediaToRender = [{name: 'merged dif name', media: [gPhs[0], gPhs[1]]},{name: '2', media: [gPhs[2], gPhs[3]]}];
component.mergeNewPhotos();
expect(component.mediaToRender).toEqual([{name: 'merged', media: [gPhs[0], gPhs[1]]}]);
expect(component.mediaToRender).toEqual([{name: 'merged', media: [gPhs[0]]}]);
/*-----------------------*/
component.mediaGroups = [{name: '3', media: [phs[0], phs[1],phs[2],phs[3]]}];
component.mediaToRender = [{name: '1', media: [gPhs[0], gPhs[1],gPhs[3], gPhs[2]]}];
component.mergeNewPhotos();
expect(component.mediaToRender).toEqual([{name: '3', media: [gPhs[0], gPhs[1]]}]);
/*-----------------------*/
gPhs[1].rowId = 3;
gPhs[3].rowId = 3;
gPhs[2].rowId = 3;
component.mediaGroups = [{name: '3', media: [phs[0], phs[1],phs[2],phs[3]]}];
component.mediaToRender = [{name: '1', media: [gPhs[0], gPhs[1],gPhs[3], gPhs[2]]}];
component.mergeNewPhotos();
expect(component.mediaToRender).toEqual([{name: '3', media: [gPhs[0]]}]);

});
});
Loading

0 comments on commit 442a9ab

Please sign in to comment.