forked from diegomura/react-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fetch assets inside dynamic content (diegomura#1369, diegomura#1587
- Loading branch information
Showing
4 changed files
with
72 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Document, Image, Page, View } from '..'; | ||
import renderToImage from './renderComponent'; | ||
|
||
const mount = async children => { | ||
const image = await renderToImage( | ||
<Document> | ||
<Page size={[244, 280]}>{children}</Page> | ||
</Document>, | ||
); | ||
|
||
return image; | ||
}; | ||
|
||
describe('dynamic content', () => { | ||
test('should render an image', async () => { | ||
const url = | ||
'https://user-images.githubusercontent.com/5600341/27505816-c8bc37aa-587f-11e7-9a86-08a2d081a8b9.png'; | ||
const image = await mount( | ||
<View | ||
render={() => <Image src={url} style={{ width: 244, height: 280 }} />} | ||
/>, | ||
); | ||
|
||
expect(image).toMatchImageSnapshot(); | ||
}, 10000); | ||
}); |
Binary file added
BIN
+20.3 KB
...shots/dynamic-content-test-js-dynamic-content-should-render-an-image-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.