1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 11:24:37 +02:00

fix(web): ensure shared link covers are full size (#12386)

This commit is contained in:
Michel Heusschen 2024-09-06 15:16:39 +02:00 committed by GitHub
parent 639bc0c660
commit ecc85ff6c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 10 additions and 10 deletions

View File

@ -19,7 +19,7 @@ describe('AlbumCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('someName'); expect(img.alt).toBe('someName');
expect(img.getAttribute('loading')).toBe('lazy'); expect(img.getAttribute('loading')).toBe('lazy');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square text'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square text');
expect(img.getAttribute('src')).toBe('/asdf'); expect(img.getAttribute('src')).toBe('/asdf');
expect(getAssetThumbnailUrl).toHaveBeenCalledWith({ id: '123' }); expect(getAssetThumbnailUrl).toHaveBeenCalledWith({ id: '123' });
}); });
@ -36,7 +36,7 @@ describe('AlbumCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('unnamed_album'); expect(img.alt).toBe('unnamed_album');
expect(img.getAttribute('loading')).toBe('eager'); expect(img.getAttribute('loading')).toBe('eager');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square asdf'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square asdf');
expect(img.getAttribute('src')).toStrictEqual(expect.any(String)); expect(img.getAttribute('src')).toStrictEqual(expect.any(String));
}); });
}); });

View File

@ -44,7 +44,7 @@
</div> </div>
{/if} {/if}
<AlbumCover {album} {preload} class="h-full w-full transition-all duration-300 hover:shadow-lg" /> <AlbumCover {album} {preload} class="transition-all duration-300 hover:shadow-lg" />
<div class="mt-4"> <div class="mt-4">
<p <p

View File

@ -13,6 +13,6 @@ describe('AssetCover component', () => {
expect(img.alt).toBe('123'); expect(img.alt).toBe('123');
expect(img.getAttribute('src')).toBe('wee'); expect(img.getAttribute('src')).toBe('wee');
expect(img.getAttribute('loading')).toBe('eager'); expect(img.getAttribute('loading')).toBe('eager');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square asdf'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square asdf');
}); });
}); });

View File

@ -10,7 +10,7 @@ describe('NoCover component', () => {
}); });
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('123'); expect(img.alt).toBe('123');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square asdf'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square asdf');
expect(img.getAttribute('loading')).toBe('eager'); expect(img.getAttribute('loading')).toBe('eager');
expect(img.src).toStrictEqual(expect.any(String)); expect(img.src).toStrictEqual(expect.any(String));
}); });

View File

@ -17,7 +17,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('123'); expect(img.alt).toBe('123');
expect(img.getAttribute('loading')).toBe('lazy'); expect(img.getAttribute('loading')).toBe('lazy');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square text'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square text');
}); });
it('renders an image when the shared link is an individual share', () => { it('renders an image when the shared link is an individual share', () => {
@ -30,7 +30,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('individual_share'); expect(img.alt).toBe('individual_share');
expect(img.getAttribute('loading')).toBe('lazy'); expect(img.getAttribute('loading')).toBe('lazy');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square text'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square text');
expect(img.getAttribute('src')).toBe('/asdf'); expect(img.getAttribute('src')).toBe('/asdf');
expect(getAssetThumbnailUrl).toHaveBeenCalledWith('someId'); expect(getAssetThumbnailUrl).toHaveBeenCalledWith('someId');
}); });
@ -44,7 +44,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement; const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('unnamed_share'); expect(img.alt).toBe('unnamed_share');
expect(img.getAttribute('loading')).toBe('lazy'); expect(img.getAttribute('loading')).toBe('lazy');
expect(img.className).toBe('z-0 rounded-xl object-cover aspect-square text'); expect(img.className).toBe('size-full rounded-xl object-cover aspect-square text');
}); });
it.skip('renders fallback image when asset is not resized', () => { it.skip('renders fallback image when asset is not resized', () => {

View File

@ -16,7 +16,7 @@
<img <img
{alt} {alt}
on:error={() => (isBroken = true)} on:error={() => (isBroken = true)}
class="z-0 rounded-xl object-cover aspect-square {className}" class="size-full rounded-xl object-cover aspect-square {className}"
data-testid="album-image" data-testid="album-image"
draggable="false" draggable="false"
loading={preload ? 'eager' : 'lazy'} loading={preload ? 'eager' : 'lazy'}

View File

@ -7,7 +7,7 @@
<enhanced:img <enhanced:img
{alt} {alt}
class="z-0 rounded-xl object-cover aspect-square {className}" class="size-full rounded-xl object-cover aspect-square {className}"
data-testid="album-image" data-testid="album-image"
draggable="false" draggable="false"
loading={preload ? 'eager' : 'lazy'} loading={preload ? 'eager' : 'lazy'}