@tamagui/react-native-web-lite
Version:
React Native for Web
48 lines (47 loc) • 1.45 kB
JavaScript
import { render } from "@testing-library/react";
import Text from "../../Text";
import ImageBackground from "..";
import { jsx } from "react/jsx-runtime";
function findImage(container) {
return container.firstChild.firstChild;
}
describe("components/ImageBackground", () => {
describe('prop "children"', () => {
test("render child content", () => {
const {
getByText
} = render(/* @__PURE__ */jsx(ImageBackground, {
children: /* @__PURE__ */jsx(Text, {
children: "Hello World!"
})
}));
expect(getByText("Hello World!")).toBeDefined();
});
}), describe('prop "imageStyle"', () => {
test("sets the style of the underlying Image", () => {
const imageStyle = {
width: 40,
height: 60
},
{
container
} = render(/* @__PURE__ */jsx(ImageBackground, {
imageStyle
}));
expect(findImage(container).getAttribute("style").includes("width: 40px; height: 60px;")).toBe(!0);
});
}), describe('prop "style"', () => {
test("sets the style of the container View", () => {
const style = {
margin: 40
},
{
container
} = render(/* @__PURE__ */jsx(ImageBackground, {
style
}));
expect(container.firstChild.getAttribute("style")).toEqual("margin: 40px 40px 40px 40px;");
});
});
});
//# sourceMappingURL=index-test.mjs.map