forked from babel/babel
/
output.js
43 lines (40 loc) 路 914 Bytes
/
output.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use strict";
let called = false;
let Base = /*#__PURE__*/function () {
function Base() {}
babelHelpers.createClass(Base, [{
key: "test",
get: function () {
called = true;
return 1;
}
}]);
return Base;
}();
;
let Obj = /*#__PURE__*/function (_Base) {
babelHelpers.inheritsLoose(Obj, _Base);
function Obj() {
return _Base.apply(this, arguments) || this;
}
var _proto = Obj.prototype;
_proto.set = function set() {
return this.test = 3;
};
return Obj;
}(Base);
Object.defineProperty(Obj.prototype, 'test', {
value: 2,
writable: true,
configurable: true
});
const obj = new Obj();
// This is incorrect according to the spec,
// but close enough for loose.
// expect(() => {
expect(obj.set()).toBe(3);
// }).toThrow(TypeError);
expect(called).toBe(false);
expect(Base.prototype.test).toBe(1);
expect(Obj.prototype.test).toBe(2);
expect(obj.test).toBe(3);