Set correct methods name

This commit is contained in:
Nicolò Ribaudo
2018-09-24 14:58:57 +02:00
parent 38397ce11f
commit d35563ee1a
4 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
function decorator() {}
@decorator
class Foo {
method() {}
}
expect(Foo.prototype.method.name).toBe("method");

View File

@@ -0,0 +1,12 @@
{
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
[
"external-helpers",
{
"helperVersion": "7.1.5"
}
]
]
}

View File

@@ -0,0 +1,16 @@
let calls = 0;
const baz = {
[Symbol.toPrimitive]() {
calls++;
return "baz";
}
}
function dec() {}
@dec
class A {
[baz]() {}
}
expect(calls).toBe(1);