* Revert "Move subclass inheritance to end (#7772)" This reverts commit f8ab9466d331871a90f458af40b14e8d831e0c29. * Only use getPrototypeOf if setPrototypeOf is implemented * Update fixtures * Helpers updates * Update fixtures * Fall back to getPrototypeOf * Update fixtures
34 lines
656 B
JavaScript
34 lines
656 B
JavaScript
"use strict";
|
|
class Base {
|
|
get test() {
|
|
// This is incorrect according to the spec,
|
|
// but close enough for loose.
|
|
expect(this).toBe(Base.prototype);
|
|
|
|
return function(...args) {
|
|
expect(this).toBe(obj);
|
|
expect(args).toEqual([1, 2, 3]);
|
|
return 1;
|
|
};
|
|
}
|
|
}
|
|
|
|
class Obj extends Base {
|
|
call() {
|
|
super.test(1, 2, 3);
|
|
super.test(1, ...[2, 3]);
|
|
super.test(...[1, 2, 3]);
|
|
return super.test(...arguments);
|
|
}
|
|
}
|
|
Object.defineProperty(Obj.prototype, 'test', {
|
|
writable: true,
|
|
configurable: true,
|
|
value() {
|
|
throw new Error("called");
|
|
}
|
|
});
|
|
|
|
const obj = new Obj();
|
|
expect(obj.call(1, 2, 3)).toBe(1);
|