未验证 提交 f1005ca6 编写于 作者: Y Yamagishi Kazutoshi 提交者: GitHub

Pass quality param of image component to preload (#18158)

If give the `priority` and `quality` attributes to an Image Component, the `quality` attribute will not be given to the preload and a warning will be displayed to the devtool.

![screenshot on devtool](https://user-images.githubusercontent.com/12539/96960307-0837e000-153d-11eb-8c01-e15afd40e04f.png)
上级 4442fe2f
......@@ -285,6 +285,7 @@ export default function Image({
widths: configSizes,
unoptimized,
sizes,
quality,
})
: ''}
<img
......
......@@ -56,6 +56,14 @@ const Page = () => {
width={300}
height={400}
/>
<Image
id="priority-image"
priority
src="withpriority.png"
width={300}
height={400}
quality={60}
/>
<Image
id="preceding-slash-image"
src="/fooslash.jpg"
......
......@@ -216,6 +216,13 @@ describe('Image Component Tests', () => {
)
).toBe(true)
})
it('should add a preload tag for a priority image, with quality', async () => {
expect(
await hasPreloadLinkMatchingUrl(
'https://example.com/myaccount/withpriority.png?auto=format&q=60'
)
).toBe(true)
})
})
describe('Client-side Image Component Tests', () => {
beforeAll(async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册