Skip to content

Commit

Permalink
tests: provide regression against #141, blur images on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamr committed Jul 23, 2020
1 parent 8450ab6 commit 60e9017
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/__tests__/regression.141.custom-blur-image.test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import React from "react";
import { Image } from "react-native";
import { render } from "react-native-testing-library";
import HTMLImage from "../HTMLImage";

function getSize(source, callback) {
setTimeout(() => callback(640, 360), 1)
}

Image.getSize = getSize.bind(Image);

/**
* https://github.com/archriss/react-native-render-html/issues/141
*/
describe("HTMLImage component should pass regression test #141", () => {
it("doesn't display the image prior to receiving original dimensions", () => {
const {} = render(<HTMLImage source={{ uri: "http://via.placeholder.com/640x360" }} />);
})
});
it("doesn't display the image prior to receiving original dimensions", async () => {
const source = { uri: "http://via.placeholder.com/640x360" };
const style = {};
const { findByTestId, getByTestId, queryByTestId } = render(
<HTMLImage key="1" style={style} source={source} />
);
const placeholder = getByTestId("image-placeholder");
expect(placeholder).toBeTruthy();
const imageLayout = queryByTestId("image-layout")
expect(imageLayout).toBeFalsy();
await expect(
findByTestId("image-layout", { timeout: 10 })
).resolves.toBeTruthy();
});
});

0 comments on commit 60e9017

Please sign in to comment.