react-native-web-internals
Version:
React Native for Web
22 lines (21 loc) • 867 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { render } from "@testing-library/react";
import * as React from "react";
import mergeRefs from "..";
describe("modules/mergeRefs", function () {
test("merges refs of different types", function () {
var ref = /* @__PURE__ */React.createRef(null),
functionRefValue = null,
hookRef;
function Component() {
var functionRef = function (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.native.js.map