babel/test/fixtures/traceur/Classes/DefaultConstructor.js
2015-01-04 19:40:09 +11:00

32 lines
573 B
JavaScript

class B {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
class C extends B {
// No constructor
}
var c = new B(1, 2);
assert.equal(1, c.x);
assert.equal(2, c.y);
assert.isFalse(
Object.getOwnPropertyDescriptor(B.prototype, 'constructor').enumerable);
assert.isFalse(
Object.getOwnPropertyDescriptor(C.prototype, 'constructor').enumerable);
// Ensure that we don't try to call super() in the default constructor.
class D extends null {}
var d = new D();
class E extends function(x) {
this.x = x;
} {}
var e = new E(42)
assert.equal(42, e.x);