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 23, 2020
1 parent 60e9017 commit 43ac44f
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 43ac44f

Please sign in to comment.