react-native-web-internals
Version:
React Native for Web
19 lines (18 loc) • 805 B
JavaScript
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.js.map