Skip to content

Commit

Permalink
Add tests for computed property names
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Dec 8, 2019
1 parent caae509 commit 3ec2e66
Show file tree
Hide file tree
Showing 13 changed files with 375 additions and 108 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/test/converter/access/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"comment": {
"shortText": "A variable that is made protected via comment."
Expand Down Expand Up @@ -116,8 +116,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -204,8 +204,8 @@
"kind": 32,
"kindString": "Variable",
"flags": {
"isExported": true,
"isProtected": true,
"isExported": true,
"isConst": true
},
"comment": {
Expand Down Expand Up @@ -265,8 +265,8 @@
"kind": 64,
"kindString": "Function",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"signatures": [
{
Expand Down
8 changes: 4 additions & 4 deletions src/test/converter/array/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
},
{
"id": 210,
"name": "__@iterator",
"name": "[Symbol.iterator]",
"kind": 2048,
"kindString": "Method",
"flags": {
Expand All @@ -134,7 +134,7 @@
"signatures": [
{
"id": 211,
"name": "__@iterator",
"name": "[Symbol.iterator]",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
Expand Down Expand Up @@ -172,7 +172,7 @@
},
{
"id": 218,
"name": "__@unscopables",
"name": "[Symbol.unscopables]",
"kind": 2048,
"kindString": "Method",
"flags": {
Expand All @@ -181,7 +181,7 @@
"signatures": [
{
"id": 219,
"name": "__@unscopables",
"name": "[Symbol.unscopables]",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
Expand Down
9 changes: 9 additions & 0 deletions src/test/converter/class/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,12 @@ abstract class NotExportedClass {
a + b;
}
}

const x = 'literal';

export class ComputedNames {
[Symbol.toStringTag] = 'computed';
[x] = true;
['literal2'] = true;
y = false;
}
163 changes: 139 additions & 24 deletions src/test/converter/class/specs-without-exported.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,120 @@
},
"originalName": "%BASE%/class/class.ts",
"children": [
{
"id": 44,
"name": "ComputedNames",
"kind": 128,
"kindString": "Class",
"flags": {
"isExported": true
},
"children": [
{
"id": 45,
"name": "[Symbol.toStringTag]",
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true
},
"sources": [
{
"fileName": "class.ts",
"line": 116,
"character": 24
}
],
"type": {
"type": "intrinsic",
"name": "string"
},
"defaultValue": "\"computed\""
},
{
"id": 46,
"name": "[x]",
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true
},
"sources": [
{
"fileName": "class.ts",
"line": 117,
"character": 7
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
},
"defaultValue": "true"
},
{
"id": 47,
"name": "literal2",
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true
},
"sources": [
{
"fileName": "class.ts",
"line": 118,
"character": 16
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
},
"defaultValue": "true"
},
{
"id": 48,
"name": "y",
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true
},
"sources": [
{
"fileName": "class.ts",
"line": 119,
"character": 5
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
},
"defaultValue": "false"
}
],
"groups": [
{
"title": "Properties",
"kind": 1024,
"children": [
45,
46,
47,
48
]
}
],
"sources": [
{
"fileName": "class.ts",
"line": 115,
"character": 26
}
]
},
{
"id": 34,
"name": "TestAbstractClass",
Expand Down Expand Up @@ -51,8 +165,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isProtected": true,
"isExported": true,
"isAbstract": true
},
"signatures": [
Expand Down Expand Up @@ -148,8 +262,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -302,8 +416,8 @@
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true,
"isPublic": true
"isPublic": true,
"isExported": true
},
"comment": {
"shortText": "publicProperty short text."
Expand Down Expand Up @@ -384,8 +498,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -417,8 +531,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isPublic": true
"isPublic": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -641,8 +755,8 @@
"kindString": "Property",
"flags": {
"isPrivate": true,
"isConstructorProperty": true,
"isExported": true
"isExported": true,
"isConstructorProperty": true
},
"comment": {
"shortText": "Private string property"
Expand All @@ -665,9 +779,9 @@
"kind": 1024,
"kindString": "Property",
"flags": {
"isConstructorProperty": true,
"isPublic": true,
"isExported": true,
"isPublic": true
"isConstructorProperty": true
},
"comment": {
"shortText": "Public number property"
Expand All @@ -690,9 +804,9 @@
"kind": 1024,
"kindString": "Property",
"flags": {
"isConstructorProperty": true,
"isPublic": true,
"isExported": true,
"isPublic": true
"isConstructorProperty": true
},
"comment": {
"shortText": "Public implicit any property\n"
Expand All @@ -715,8 +829,8 @@
"kind": 1024,
"kindString": "Property",
"flags": {
"isExported": true,
"isPublic": true
"isPublic": true,
"isExported": true
},
"comment": {
"shortText": "publicProperty short text."
Expand Down Expand Up @@ -806,8 +920,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isProtected": true
"isProtected": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -849,8 +963,8 @@
"kind": 2048,
"kindString": "Method",
"flags": {
"isExported": true,
"isPublic": true
"isPublic": true,
"isExported": true
},
"signatures": [
{
Expand Down Expand Up @@ -887,7 +1001,7 @@
}
},
{
"id": 44,
"id": 49,
"name": "staticMergedMethod",
"kind": 2048,
"kindString": "Method",
Expand All @@ -897,7 +1011,7 @@
},
"signatures": [
{
"id": 45,
"id": 50,
"name": "staticMergedMethod",
"kind": 4096,
"kindString": "Call signature",
Expand Down Expand Up @@ -989,7 +1103,7 @@
42,
19,
17,
44,
49,
32
]
}
Expand Down Expand Up @@ -1025,6 +1139,7 @@
"title": "Classes",
"kind": 128,
"children": [
44,
34,
38,
2,
Expand Down

0 comments on commit 3ec2e66

Please sign in to comment.