mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibJS: Indent tests with 4 spaces instead of 2
This commit is contained in:
parent
15de2eda2b
commit
1ef573eb30
261 changed files with 8536 additions and 8497 deletions
|
@ -1,100 +1,100 @@
|
|||
test("basic functionality", () => {
|
||||
class A {
|
||||
get x() {
|
||||
return this._x;
|
||||
class A {
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
|
||||
expect(A.x).toBeUndefined();
|
||||
expect(A).not.toHaveProperty("_x");
|
||||
const a = new A();
|
||||
expect(a.x).toBeUndefined();
|
||||
expect(a).not.toHaveProperty("_x");
|
||||
a.x = 3;
|
||||
expect(a.x).toBe(6);
|
||||
expect(a).toHaveProperty("_x", 6);
|
||||
expect(A.x).toBeUndefined();
|
||||
expect(A).not.toHaveProperty("_x");
|
||||
const a = new A();
|
||||
expect(a.x).toBeUndefined();
|
||||
expect(a).not.toHaveProperty("_x");
|
||||
a.x = 3;
|
||||
expect(a.x).toBe(6);
|
||||
expect(a).toHaveProperty("_x", 6);
|
||||
});
|
||||
|
||||
test("name", () => {
|
||||
class A {
|
||||
set x(v) {}
|
||||
}
|
||||
class A {
|
||||
set x(v) {}
|
||||
}
|
||||
|
||||
const d = Object.getOwnPropertyDescriptor(A.prototype, "x");
|
||||
expect(d.set.name).toBe("set x");
|
||||
const d = Object.getOwnPropertyDescriptor(A.prototype, "x");
|
||||
expect(d.set.name).toBe("set x");
|
||||
});
|
||||
|
||||
test("extended name syntax", () => {
|
||||
class A {
|
||||
set "method with space"(value) {
|
||||
this.a = value;
|
||||
class A {
|
||||
set "method with space"(value) {
|
||||
this.a = value;
|
||||
}
|
||||
|
||||
set 12(value) {
|
||||
this.b = value;
|
||||
}
|
||||
|
||||
set [`he${"llo"}`](value) {
|
||||
this.c = value;
|
||||
}
|
||||
}
|
||||
|
||||
set 12(value) {
|
||||
this.b = value;
|
||||
}
|
||||
|
||||
set [`he${"llo"}`](value) {
|
||||
this.c = value;
|
||||
}
|
||||
}
|
||||
|
||||
const a = new A();
|
||||
a["method with space"] = 1;
|
||||
a[12] = 2;
|
||||
a.hello = 3;
|
||||
expect(a.a).toBe(1);
|
||||
expect(a.b).toBe(2);
|
||||
expect(a.c).toBe(3);
|
||||
const a = new A();
|
||||
a["method with space"] = 1;
|
||||
a[12] = 2;
|
||||
a.hello = 3;
|
||||
expect(a.a).toBe(1);
|
||||
expect(a.b).toBe(2);
|
||||
expect(a.c).toBe(3);
|
||||
});
|
||||
|
||||
test("inherited setter", () => {
|
||||
class Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
class Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
class Child extends Parent {}
|
||||
|
||||
class Child extends Parent {}
|
||||
const c = new Child();
|
||||
|
||||
const c = new Child();
|
||||
|
||||
expect(c.x).toBeUndefined();
|
||||
c.x = 10;
|
||||
expect(c.x).toBe(20);
|
||||
expect(c.x).toBeUndefined();
|
||||
c.x = 10;
|
||||
expect(c.x).toBe(20);
|
||||
});
|
||||
|
||||
test("inherited static setter overriding", () => {
|
||||
class Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
class Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 2;
|
||||
}
|
||||
}
|
||||
class Child extends Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
get x() {
|
||||
return this._x;
|
||||
set x(value) {
|
||||
this._x = value * 3;
|
||||
}
|
||||
}
|
||||
|
||||
set x(value) {
|
||||
this._x = value * 3;
|
||||
}
|
||||
}
|
||||
|
||||
const c = new Child();
|
||||
expect(c.x).toBeUndefined();
|
||||
c.x = 10;
|
||||
expect(c.x).toBe(30);
|
||||
const c = new Child();
|
||||
expect(c.x).toBeUndefined();
|
||||
c.x = 10;
|
||||
expect(c.x).toBe(30);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue