26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
define(["require", "exports", "tslib", "react", "./initializeComponentRef", "@testing-library/react"], function (require, exports, tslib_1, React, initializeComponentRef_1, react_1) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
describe('initializeComponentRef', function () {
|
|
var Foo = /** @class */ (function (_super) {
|
|
tslib_1.__extends(Foo, _super);
|
|
function Foo(props) {
|
|
var _this = _super.call(this, props) || this;
|
|
(0, initializeComponentRef_1.initializeComponentRef)(_this);
|
|
return _this;
|
|
}
|
|
Foo.prototype.render = function () {
|
|
return React.createElement("div", null);
|
|
};
|
|
return Foo;
|
|
}(React.Component));
|
|
it('can resolve componentRef', function () {
|
|
var fooRef = React.createRef();
|
|
var component = (0, react_1.render)(React.createElement(Foo, { componentRef: fooRef }));
|
|
expect(fooRef.current).toBeTruthy();
|
|
component.unmount();
|
|
expect(fooRef.current).toBeNull();
|
|
});
|
|
});
|
|
});
|
|
//# sourceMappingURL=initializeComponentRef.test.js.map
|