import { __extends } from "tslib"; import * as React from 'react'; import { createMergedRef } from './createMergedRef'; import { mount } from 'enzyme'; describe('createMergedRef', function () { it('can merge refs', function () { var ref1 = React.createRef(); var Foo = /** @class */ (function (_super) { __extends(Foo, _super); function Foo() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.mergedRef = createMergedRef(); return _this; } Foo.prototype.render = function () { return React.createElement("div", { ref: this.mergedRef(this.props.domRef, ref1) }); }; return Foo; }(React.Component)); var ref2 = React.createRef(); var wrapper = mount(React.createElement(Foo, { domRef: ref2 })); expect(ref1.current).toBeTruthy(); expect(ref2.current).toBeTruthy(); wrapper.unmount(); expect(ref1.current).toBeNull(); expect(ref2.current).toBeNull(); }); it('returns the same ref object with the same input twice', function () { var mergedRef = createMergedRef(); expect(mergedRef()).toBe(mergedRef()); }); it('should return a new resolver if the refs change', function () { var mergedRef = createMergedRef(); expect(mergedRef(null)).not.toBe(mergedRef(React.createRef())); }); }); //# sourceMappingURL=createMergedRef.test.js.map