Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...l-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/decorators/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var log = []; | ||
|
||
function push(x) { log.push(x); return x; } | ||
|
||
function logDecoratorRun(a, b) { | ||
push(a); | ||
return function (el) { push(b); return el; }; | ||
} | ||
|
||
@logDecoratorRun(0, 19) | ||
@logDecoratorRun(1, 18) | ||
class A { | ||
@logDecoratorRun(2, 11) | ||
@logDecoratorRun(3, 10) | ||
a; | ||
|
||
@logDecoratorRun(4, 13) | ||
@logDecoratorRun(5, 12) | ||
static b; | ||
|
||
@logDecoratorRun(6, 15) | ||
@logDecoratorRun(7, 14) | ||
static #c; | ||
|
||
@logDecoratorRun(8, 17) | ||
@logDecoratorRun(9, 16) | ||
#d; | ||
} | ||
|
||
var nums = Array.from({ length: 20 }, (_, i) => i); | ||
expect(log).toEqual(nums); |
27 changes: 27 additions & 0 deletions
27
...rators/test/fixtures/2021-12-ordering--to-es2015/field-initializers-after-methods/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var counter = 0; | ||
|
||
@(x => x) | ||
class A { | ||
foo = (() => { | ||
counter++; | ||
expect(typeof this.method).toBe("function"); | ||
expect(this.foo).toBeUndefined(); | ||
expect(this.bar).toBeUndefined(); | ||
return "foo"; | ||
})(); | ||
|
||
method() {} | ||
|
||
bar = (() => { | ||
counter++; | ||
expect(typeof this.method).toBe("function"); | ||
expect(this.foo).toBe("foo"); | ||
expect(this.bar).toBeUndefined(); | ||
})(); | ||
} | ||
|
||
expect(counter).toBe(0); | ||
|
||
new A(); | ||
|
||
expect(counter).toBe(2); |
8 changes: 8 additions & 0 deletions
8
...s/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-decorators", { "version": "2021-12" }], | ||
"proposal-class-properties", | ||
"proposal-private-methods", | ||
"proposal-class-static-block" | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
...test/fixtures/2021-12-ordering--to-es2015/static-field-initializers-after-methods/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var counter = 0; | ||
|
||
@(x => x) | ||
class A { | ||
static foo = (() => { | ||
counter++; | ||
expect(typeof this.method).toBe("function"); | ||
expect(this.foo).toBeUndefined(); | ||
expect(this.bar).toBeUndefined(); | ||
return "foo"; | ||
})(); | ||
|
||
static method() {} | ||
|
||
static bar = (() => { | ||
counter++; | ||
expect(typeof this.method).toBe("function"); | ||
expect(this.foo).toBe("foo"); | ||
expect(this.bar).toBeUndefined(); | ||
})(); | ||
} | ||
|
||
expect(counter).toBe(2); |
3 changes: 2 additions & 1 deletion
3
packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"plugins": [["proposal-decorators", { "version": "2021-12" }]] | ||
"plugins": [["proposal-decorators", { "version": "2021-12" }]], | ||
"minNodeVersion": "16.11" | ||
} |