Skip to content

Commit

Permalink
Merge #1864
Browse files Browse the repository at this point in the history
1864: chore(spec): add test for image handling r=herschel666 a=herschel666

<details>
<summary>Bors merge bot cheat sheet</summary>

We are using [bors-ng](https://github.com/bors-ng/bors-ng) to automate merging of our pull requests. The following table provides a summary of commands that are available to reviewers (members of this repository with push access) and delegates (in case of `bors delegate+` or `bors delegate=[list]`).

| Syntax | Description |
| --- | --- |
| bors merge | Run the test suite and push to master if it passes. Short for "reviewed: looks good." |
| bors merge- | Cancel an r+, r=, merge, or merge= |
| bors try | Run the test suite without pushing to master. |
| bors try- | Cancel a try |
| bors delegate+ | Allow the pull request author to merge their changes. |
| bors delegate=[list] | Allow the listed users to r+ this pull request's changes. |
| bors retry | Run the previous command a second time. |

This is a short collection of opinionated commands. For a full list of the commands read the [bors reference](https://bors.tech/documentation/).

</details>


Co-authored-by: Emanuel Kluge <[email protected]>
  • Loading branch information
bors[bot] and Emanuel Kluge authored Jun 15, 2021
2 parents 00d7f55 + 008e093 commit 74899ea
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/spec/integration/react/__tests__/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
15 changes: 15 additions & 0 deletions packages/spec/integration/react/images.js
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<img src={gif} alt="" />
<img src={jpg} alt="" />
<img src={png} alt="" />
</div>
);
}
Binary file added packages/spec/integration/react/img/img.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/spec/integration/react/img/img.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/spec/integration/react/img/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/spec/integration/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const BoldText = importComponent(() =>
'./bold-text'
)
);
const Images = importComponent(
() => import('./images'),
(mod) => mod.Images
);

const ServerDataHoC = withServerData(({ serverData }) => (
<output>{serverData.method}</output>
Expand Down Expand Up @@ -58,6 +62,9 @@ export default render(
</Helmet>
<div>
<Link to="/two">Link to two</Link>
<>&#8199;</>
<Link to="/images">Link to images</Link>
<>&#8199;</>
<Link to="/import">Link to import</Link>
<Switch>
<Route path="/" exact render={() => <h1>home</h1>} />
Expand All @@ -75,6 +82,7 @@ export default render(
<Route path="/server-data-hook" exact component={ServerDataHook} />
<Route path="/config-hoc" exact component={ConfigHoC} />
<Route path="/config-hook" exact component={ConfigHook} />
<Route path="/images" exact component={Images} />
<Miss />
</Switch>
</div>
Expand Down

0 comments on commit 74899ea

Please sign in to comment.