@tamagui/react-native-web-lite
Version:
React Native for Web
49 lines (48 loc) • 1.52 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { render } from "@testing-library/react";
import "react";
import Text from "../../Text";
import ImageBackground from "..";
function findImage(container) {
return container.firstChild.firstChild;
}
describe("components/ImageBackground", function () {
describe('prop "children"', function () {
test("render child content", function () {
var {
getByText
} = render(/* @__PURE__ */_jsx(ImageBackground, {
children: /* @__PURE__ */_jsx(Text, {
children: "Hello World!"
})
}));
expect(getByText("Hello World!")).toBeDefined();
});
}), describe('prop "imageStyle"', function () {
test("sets the style of the underlying Image", function () {
var 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"', function () {
test("sets the style of the container View", function () {
var style = {
margin: 40
},
{
container
} = render(/* @__PURE__ */_jsx(ImageBackground, {
style
}));
expect(container.firstChild.getAttribute("style")).toEqual("margin: 40px 40px 40px 40px;");
});
});
});
//# sourceMappingURL=index-test.native.js.map