-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: provide regression against #172, ignored resize-mode
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/__tests__/regression.172.custom-image-resize-mode.test.js
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,31 @@ | ||
import React from "react"; | ||
import { render } from "react-native-testing-library"; | ||
import { StyleSheet } from "react-native"; | ||
import HTML from "../HTML"; | ||
|
||
/** | ||
* https://github.com/archriss/react-native-render-html/issues/172 | ||
*/ | ||
describe("HTMLImage component should pass regression test #172", () => { | ||
it("passes resizeMode to RN Image component", async () => { | ||
const source = { uri: "http://via.placeholder.com/640x360" }; | ||
const tagsStyles = { | ||
img: { | ||
resizeMode: "contain", | ||
width: 100, | ||
height: 100 | ||
}, | ||
}; | ||
const { getByTestId } = render( | ||
<HTML | ||
html='<img width="100" height="100" src="http://via.placeholder.com/100x100" />' | ||
tagsStyles={tagsStyles} | ||
source={source} | ||
/> | ||
); | ||
const imageLayout = getByTestId("image-layout"); | ||
expect(StyleSheet.flatten(imageLayout.props.style)).toMatchObject( | ||
tagsStyles.img | ||
); | ||
}); | ||
}); |