Skip to content

Commit

Permalink
test(transformer/class-properties): exec test for this in computed …
Browse files Browse the repository at this point in the history
…key (#7687)

Add an exec test for #7686.
  • Loading branch information
overlookmotel committed Dec 8, 2024
1 parent 65a1c31 commit da63e87
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 1 addition & 4 deletions tasks/transform_conformance/snapshots/oxc_exec.snap.md
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%)
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);

0 comments on commit da63e87

Please sign in to comment.