-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(transformer/class-properties): exec test for
this
in computed …
- Loading branch information
1 parent
65a1c31
commit da63e87
Showing
2 changed files
with
23 additions
and
4 deletions.
There are no files selected for viewing
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,8 +1,5 @@ | ||
commit: 54a8389f | ||
|
||
node: v22.12.0 | ||
filter: fixtures/oxc | ||
include: **/*.{test,spec}.?(c|m)[jt]s?(x) | ||
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*, "" | ||
|
||
No test files found, exiting with code 1 | ||
Passed: 1 of 1 (100.00%) |
22 changes: 22 additions & 0 deletions
22
.../tests/babel-plugin-transform-class-properties/test/fixtures/this-in-computed-key/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,22 @@ | ||
function createClassDeclaration() { | ||
class C { | ||
[this] = 1; | ||
[this + 'bar'] = 2; | ||
} | ||
return C; | ||
} | ||
|
||
function createClassExpression() { | ||
return class { | ||
[this] = 3; | ||
[this + 'bar'] = 4; | ||
}; | ||
} | ||
|
||
const C = createClassDeclaration.call("foo"); | ||
expect(new C().foo).toBe(1); | ||
expect(new C().foobar).toBe(2); | ||
|
||
const D = createClassExpression.call("foo"); | ||
expect(new D().foo).toBe(3); | ||
expect(new D().foobar).toBe(4); |