Skip to content
Draft
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
16 changes: 16 additions & 0 deletions src/app/components/Billboard/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,22 @@ describe('Billboard', () => {
maskedImageSpy.mockRestore();
});

it('includes a retina (2x) resolution in the srcset so high-DPI screens are not upscaled', () => {
render(
<Billboard
heading={title}
description={description}
link={link}
image={imageUrl}
altText={imageAlt}
prominence={VISUAL_PROMINENCE.HIGH}
/>,
);

const image = screen.getByAltText(imageAlt);
expect(image.getAttribute('srcset')).toContain('1320w');
});
Comment on lines +296 to +310

it('renders the curation grid when promo items are present', () => {
const maskedImageSpy = jest.spyOn(MaskedImage, 'default');

Expand Down
7 changes: 6 additions & 1 deletion src/app/components/Billboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ interface BillboardProps {
}

const IMAGE_WIDTH = 660;
// 2x the fixed 660px display width (desktop ≥1280px), so high-DPI/retina
// screens get a sharp source instead of upscaling the 660w image.
const IMAGE_WIDTH_RETINA = IMAGE_WIDTH * 2;
Comment on lines +39 to +41
const IMAGE_RESOLUTIONS = [240, 320, 480, 624, 800, IMAGE_WIDTH_RETINA];
const DEFAULT_IMAGE_RES = 480;

export default ({
Expand Down Expand Up @@ -87,7 +91,8 @@ export default ({
createSrcsets({
originCode,
locator,
originalImageWidth: IMAGE_WIDTH,
imageResolutions: IMAGE_RESOLUTIONS,
originalImageWidth: IMAGE_WIDTH_RETINA,
});
const srcWebp = buildIChefURL({
originCode,
Expand Down
Loading