first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { __extends } from "tslib";
import * as React from 'react';
import { render } from '@testing-library/react';
import { extendComponent } from './extendComponent';
describe('extendComponent', function () {
it('can extend a component with custom lifetime methods', function () {
var didMount = 0;
var willUnmount = 0;
var Foo = /** @class */ (function (_super) {
__extends(Foo, _super);
function Foo(props) {
var _this = _super.call(this, props) || this;
extendComponent(_this, {
componentDidMount: function () { return didMount++; },
componentWillUnmount: function () { return willUnmount++; },
});
return _this;
}
Foo.prototype.componentDidMount = function () {
didMount++;
};
Foo.prototype.componentWillUnmount = function () {
willUnmount++;
};
Foo.prototype.render = function () {
return React.createElement("div", null);
};
return Foo;
}(React.Component));
var component = render(React.createElement(Foo, null));
component.unmount();
expect(didMount).toEqual(2);
expect(willUnmount).toEqual(2);
});
});
//# sourceMappingURL=extendComponent.test.js.map