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(common): update size error to mention 'fill' mode #47797

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -830,7 +830,8 @@ function assertNonEmptyWidthAndHeight(dir: NgOptimizedImage) {
`${imgDirectiveDetails(dir.ngSrc)} these required attributes ` +
`are missing: ${missingAttributes.map(attr => `"${attr}"`).join(', ')}. ` +
`Including "width" and "height" attributes will prevent image-related layout shifts. ` +
`To fix this, include "width" and "height" attributes on the image tag.`);
`To fix this, include "width" and "height" attributes on the image tag or turn on ` +
`"fill" mode with the \`fill\` attribute.`);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/common/test/directives/ng_optimized_image_spec.ts
Expand Up @@ -359,7 +359,8 @@ describe('Image directive', () => {
'element with the `ngSrc="img.png"`) has detected that these ' +
'required attributes are missing: "width", "height". Including "width" and ' +
'"height" attributes will prevent image-related layout shifts. ' +
'To fix this, include "width" and "height" attributes on the image tag.');
'To fix this, include "width" and "height" attributes on the image tag or turn on ' +
'"fill" mode with the `fill` attribute.');
});

it('should throw if `width` is not set', () => {
Expand All @@ -375,7 +376,8 @@ describe('Image directive', () => {
'element with the `ngSrc="img.png"`) has detected that these ' +
'required attributes are missing: "width". Including "width" and ' +
'"height" attributes will prevent image-related layout shifts. ' +
'To fix this, include "width" and "height" attributes on the image tag.');
'To fix this, include "width" and "height" attributes on the image tag or turn on ' +
'"fill" mode with the `fill` attribute.');
});

it('should throw if `width` is 0', () => {
Expand Down Expand Up @@ -421,7 +423,8 @@ describe('Image directive', () => {
'element with the `ngSrc="img.png"`) has detected that these required ' +
'attributes are missing: "height". Including "width" and "height" ' +
'attributes will prevent image-related layout shifts. ' +
'To fix this, include "width" and "height" attributes on the image tag.');
'To fix this, include "width" and "height" attributes on the image tag or turn on ' +
'"fill" mode with the `fill` attribute.');
});

it('should throw if `height` is 0', () => {
Expand Down