diff --git a/packages/spec/integration/react/__tests__/develop.js b/packages/spec/integration/react/__tests__/develop.js index ea051b903..b3234f7ac 100644 --- a/packages/spec/integration/react/__tests__/develop.js +++ b/packages/spec/integration/react/__tests__/develop.js @@ -151,4 +151,15 @@ describe('react development server', () => { const content = await response.text(); expect(content).toMatch('data:;base64,iVBORw0KGgo='); }); + + it('renders images', async () => { + const { page } = await createPage(); + page.on('console', (msg) => handleConsoleOutput(msg)); + await page.goto(urlJoin(url, '/images'), { waitUntil: 'networkidle2' }); + + await expect(page.$$('img[src^="data:image/"]')).resolves.toHaveLength(2); + await expect(page.$$('img[src$=".png"]')).resolves.toHaveLength(1); + + await page.close(); + }); }); diff --git a/packages/spec/integration/react/images.js b/packages/spec/integration/react/images.js new file mode 100644 index 000000000..8f20f85ff --- /dev/null +++ b/packages/spec/integration/react/images.js @@ -0,0 +1,15 @@ +/* eslint react/react-in-jsx-scope: off */ +import gif from './img/img.gif'; +import jpg from './img/img.jpg'; +// eslint-disable-next-line import/no-unresolved +import png from './img/img.png?noinline'; + +export function Images() { + return ( +
+ + + +
+ ); +} diff --git a/packages/spec/integration/react/img/img.gif b/packages/spec/integration/react/img/img.gif new file mode 100644 index 000000000..a9f45fba1 Binary files /dev/null and b/packages/spec/integration/react/img/img.gif differ diff --git a/packages/spec/integration/react/img/img.jpg b/packages/spec/integration/react/img/img.jpg new file mode 100644 index 000000000..f0122d2a6 Binary files /dev/null and b/packages/spec/integration/react/img/img.jpg differ diff --git a/packages/spec/integration/react/img/img.png b/packages/spec/integration/react/img/img.png new file mode 100644 index 000000000..2fe28863d Binary files /dev/null and b/packages/spec/integration/react/img/img.png differ diff --git a/packages/spec/integration/react/index.js b/packages/spec/integration/react/index.js index 5784398df..de282c7cf 100644 --- a/packages/spec/integration/react/index.js +++ b/packages/spec/integration/react/index.js @@ -24,6 +24,10 @@ const BoldText = importComponent(() => './bold-text' ) ); +const Images = importComponent( + () => import('./images'), + (mod) => mod.Images +); const ServerDataHoC = withServerData(({ serverData }) => ( {serverData.method} @@ -58,6 +62,9 @@ export default render(
Link to two + <>  + Link to images + <>  Link to import

home

} /> @@ -75,6 +82,7 @@ export default render( +