Skip to content

Commit

Permalink
tests: provide regression against #172, ignored resize-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamr committed Jul 24, 2020
1 parent c68ae87 commit 5c733e2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/__tests__/regression.172.custom-image-resize-mode.test.js
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
);
});
});

0 comments on commit 5c733e2

Please sign in to comment.