UNPKG

react-native-web-internals

Version:

React Native for Web

22 lines (21 loc) 822 B
import { render } from "@testing-library/react"; import * as React from "react"; import mergeRefs from ".."; import { jsx } from "react/jsx-runtime"; describe("modules/mergeRefs", () => { test("merges refs of different types", () => { const ref = React.createRef(null); let functionRefValue = null, hookRef; function Component() { const functionRef = x => { functionRefValue = x; }; return hookRef = React.useRef(null), /* @__PURE__ */jsx("div", { ref: mergeRefs(ref, hookRef, functionRef) }); } render(/* @__PURE__ */jsx(Component, {})), expect(ref.current).toBeInstanceOf(HTMLDivElement), expect(hookRef.current).toBeInstanceOf(HTMLDivElement), expect(functionRefValue).toBeInstanceOf(HTMLDivElement); }); }); //# sourceMappingURL=index-test.mjs.map