mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* clean * improve * tests * fix lint * old helpers * add fail test * fix * Update packages/babel-helpers/src/helpers/superPropGet.ts Co-authored-by: Nicolò Ribaudo <[email protected]> * review * fix lint * minVersion --------- Co-authored-by: Nicolò Ribaudo <[email protected]>
42 lines
992 B
JavaScript
42 lines
992 B
JavaScript
"use strict";
|
|
|
|
let Base = /*#__PURE__*/function () {
|
|
function Base() {
|
|
babelHelpers.classCallCheck(this, Base);
|
|
}
|
|
return babelHelpers.createClass(Base, [{
|
|
key: "test",
|
|
get: function () {
|
|
return 1;
|
|
}
|
|
}]);
|
|
}();
|
|
;
|
|
let Obj = /*#__PURE__*/function (_Base) {
|
|
function Obj() {
|
|
babelHelpers.classCallCheck(this, Obj);
|
|
return babelHelpers.callSuper(this, Obj, arguments);
|
|
}
|
|
babelHelpers.inherits(Obj, _Base);
|
|
return babelHelpers.createClass(Obj, [{
|
|
key: "set",
|
|
value: function set() {
|
|
return babelHelpers.superPropSet(Obj, "test", 3, this, 1, 1);
|
|
}
|
|
}]);
|
|
}(Base);
|
|
Object.defineProperty(Obj.prototype, 'test', {
|
|
value: 2,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
const obj = new Obj();
|
|
expect(() => {
|
|
// this requires helpers to be in file (not external), so they
|
|
// are in "strict" mode code.
|
|
obj.set();
|
|
}).toThrow(TypeError);
|
|
expect(Base.prototype.test).toBe(1);
|
|
expect(Obj.prototype.test).toBe(2);
|
|
expect(obj.test).toBe(2);
|