Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Keep sizes attribute on img tag
Browse files Browse the repository at this point in the history
  • Loading branch information
amoore108 committed Feb 15, 2022
1 parent f0549c6 commit ae49851
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports[`Image - imported as '{ Img }' should render image correctly without wid
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
/>
</picture>
Expand All @@ -56,6 +57,7 @@ exports[`Image - imported as '{ Img }' should render image with custom dimension
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
height="547"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/164BB/production/_104032319_03270dcc-9dda-4bd4-96a0-db89f6b915ae.jpg"
width="445"
/>
Expand Down Expand Up @@ -88,6 +90,7 @@ exports[`Image - imported as '{ Img }' should render image with only srcset corr
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -125,6 +128,7 @@ exports[`Image - imported as '{ Img }' should render image with srcset and fallb
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -152,6 +156,7 @@ exports[`Image - imported as '{ Img }' should render landscape image correctly 1
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -179,6 +184,7 @@ exports[`Image - imported as '{ Img }' should render portrait image correctly 1`
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
height="1280"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/439A/production/_100960371_syrians_and_asylum_v2-nc.png"
width="1024"
/>
Expand Down Expand Up @@ -206,6 +212,7 @@ exports[`Image - imported as '{ Img }' should render square image correctly 1`]
alt="Tracks through the snow"
class="emotion-2 emotion-3"
height="1024"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/114FE/production/_104801907_79010.jpg"
width="1024"
/>
Expand Down Expand Up @@ -243,6 +250,7 @@ exports[`Image - imported as default 'Image' should render image correctly witho
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
/>
</picture>
Expand All @@ -269,6 +277,7 @@ exports[`Image - imported as default 'Image' should render image with custom dim
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
height="547"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/164BB/production/_104032319_03270dcc-9dda-4bd4-96a0-db89f6b915ae.jpg"
width="445"
/>
Expand Down Expand Up @@ -301,6 +310,7 @@ exports[`Image - imported as default 'Image' should render image with only srcse
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -338,6 +348,7 @@ exports[`Image - imported as default 'Image' should render image with srcset and
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -365,6 +376,7 @@ exports[`Image - imported as default 'Image' should render landscape image corre
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -392,6 +404,7 @@ exports[`Image - imported as default 'Image' should render portrait image correc
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
height="1280"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/439A/production/_100960371_syrians_and_asylum_v2-nc.png"
width="1024"
/>
Expand Down Expand Up @@ -419,6 +432,7 @@ exports[`Image - imported as default 'Image' should render square image correctl
alt="Tracks through the snow"
class="emotion-2 emotion-3"
height="1024"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/114FE/production/_104801907_79010.jpg"
width="1024"
/>
Expand Down Expand Up @@ -456,6 +470,7 @@ exports[`Image - with Fade-in effect' should render image correctly without widt
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
/>
</picture>
Expand All @@ -482,6 +497,7 @@ exports[`Image - with Fade-in effect' should render image with custom dimensions
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
height="547"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/164BB/production/_104032319_03270dcc-9dda-4bd4-96a0-db89f6b915ae.jpg"
width="445"
/>
Expand Down Expand Up @@ -514,6 +530,7 @@ exports[`Image - with Fade-in effect' should render image with only srcset corre
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -551,6 +568,7 @@ exports[`Image - with Fade-in effect' should render image with srcset and fallba
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -578,6 +596,7 @@ exports[`Image - with Fade-in effect' should render landscape image correctly 1`
alt="Student sitting an exam"
class="emotion-2 emotion-3"
height="576"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/7098/production/_104842882_students.jpg"
width="1024"
/>
Expand Down Expand Up @@ -605,6 +624,7 @@ exports[`Image - with Fade-in effect' should render portrait image correctly 1`]
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
height="1280"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/439A/production/_100960371_syrians_and_asylum_v2-nc.png"
width="1024"
/>
Expand Down Expand Up @@ -632,6 +652,7 @@ exports[`Image - with Fade-in effect' should render square image correctly 1`] =
alt="Tracks through the snow"
class="emotion-2 emotion-3"
height="1024"
sizes="100vw"
src="https://ichef.bbci.co.uk/news/300/cpsprodpb/114FE/production/_104801907_79010.jpg"
width="1024"
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-image/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const Img = props => {
{fallbackSrcset && (
<source srcSet={fallbackSrcset} type={fallbackMimeType} sizes={sizes} />
)}
<StyledImg src={src} {...otherProps} />
<StyledImg src={src} sizes={sizes} {...otherProps} />
</StyledPicture>
);
};
Expand Down

0 comments on commit ae49851

Please sign in to comment.