Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('AlbumCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('someName');
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(getAssetThumbnailUrl).toHaveBeenCalledWith({ id: '123' });
});
Expand All @@ -36,7 +36,7 @@ describe('AlbumCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('unnamed_album');
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));
});
});
2 changes: 1 addition & 1 deletion web/src/lib/components/album-page/album-card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
{/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">
<p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ describe('AssetCover component', () => {
expect(img.alt).toBe('123');
expect(img.getAttribute('src')).toBe('wee');
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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('NoCover component', () => {
});
const img = component.getByTestId('album-image') as HTMLImageElement;
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.src).toStrictEqual(expect.any(String));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('123');
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', () => {
Expand All @@ -30,7 +30,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('individual_share');
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(getAssetThumbnailUrl).toHaveBeenCalledWith('someId');
});
Expand All @@ -44,7 +44,7 @@ describe('ShareCover component', () => {
const img = component.getByTestId('album-image') as HTMLImageElement;
expect(img.alt).toBe('unnamed_share');
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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<img
{alt}
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"
draggable="false"
loading={preload ? 'eager' : 'lazy'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<enhanced:img
{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"
draggable="false"
loading={preload ? 'eager' : 'lazy'}
Expand Down
Loading