rsnext/test/integration/image-component/custom-resolver/pages/client-side.js
JJ Kasper 417a712066
Update next/image test (#20986)
This ensures the page has transitioned fully before testing which should resolve the random failure seen in a couple of runs. 
 
x-ref: https://github.com/vercel/next.js/pull/20918#issuecomment-758155230
2021-01-13 15:05:08 +00:00

36 lines
741 B
JavaScript

import React from 'react'
import Image from 'next/image'
const myLoader = ({ src, width, quality }) => {
return `https://customresolver.com/${src}?w~~${width},q~~${quality}`
}
const MyImage = (props) => {
return <Image loader={myLoader} {...props}></Image>
}
const Page = () => {
return (
<div>
<p id="client-side">Image Client Side Test</p>
<MyImage
id="basic-image"
src="foo.jpg"
loading="eager"
width={300}
height={400}
quality={60}
/>
<Image
id="unoptimized-image"
unoptimized
src="https://arbitraryurl.com/foo.jpg"
loading="eager"
width={300}
height={400}
/>
</div>
)
}
export default Page