Skip to content

Commit

Permalink
Fix hydrogen-react test
Browse files Browse the repository at this point in the history
  • Loading branch information
wizardlyhel committed Feb 24, 2025
1 parent ef46187 commit e753527
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/hydrogen-react/src/Image.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('<Image />', () => {
// expect(image).toHaveStyle('aspect-ratio: 1 / 1');

it('sets the aspect-ratio on the style prop when set explicitly', () => {
const aspectRatio = '4/3';
const aspectRatio = '4 / 3';

render(
<Image {...defaultProps} sizes="100vw" aspectRatio={aspectRatio} />,
Expand All @@ -121,15 +121,15 @@ describe('<Image />', () => {

render(<Image {...defaultProps} sizes="100vw" data={data} />);

expect(screen.getByRole('img').style.aspectRatio).toBe('400/300');
expect(screen.getByRole('img').style.aspectRatio).toBe('400 / 300');
});

it('infers the aspect-ratio from the storefront data for fixed-width images when no height prop is provided', () => {
const data = {height: 300, width: 400};

render(<Image {...defaultProps} sizes="100vw" data={data} width={600} />);

expect(screen.getByRole('img').style.aspectRatio).toBe('400/300');
expect(screen.getByRole('img').style.aspectRatio).toBe('400 / 300');
});

it('infers the aspect-ratio from the storefront data for fixed-width images the height and width are different units', () => {
Expand All @@ -145,7 +145,7 @@ describe('<Image />', () => {
/>,
);

expect(screen.getByRole('img').style.aspectRatio).toBe('400/300');
expect(screen.getByRole('img').style.aspectRatio).toBe('400 / 300');
});

it('infers the aspect-ratio from the height and width props for fixed-width images', () => {
Expand All @@ -161,7 +161,7 @@ describe('<Image />', () => {
/>,
);

expect(screen.getByRole('img').style.aspectRatio).toBe('600/400');
expect(screen.getByRole('img').style.aspectRatio).toBe('600 / 400');
});

it('does not create srcset with greater dimensions than source image', () => {
Expand Down

0 comments on commit e753527

Please sign in to comment.