Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add static parameter to class property builder
- Loading branch information
1 parent
fced5ce
commit dc9ff74
Showing
3 changed files
with
65 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
packages/babel-types/test/builders/experimental/__snapshots__/classProperty.js.snap
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,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`builders experimental classProperty should validate 1`] = ` | ||
Object { | ||
"computed": false, | ||
"decorators": null, | ||
"key": Object { | ||
"type": "StringLiteral", | ||
"value": "test", | ||
}, | ||
"static": null, | ||
"type": "ClassProperty", | ||
"typeAnnotation": null, | ||
"value": Object { | ||
"type": "NumericLiteral", | ||
"value": 1, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`builders experimental classProperty should validate 2`] = ` | ||
Object { | ||
"computed": false, | ||
"decorators": null, | ||
"key": Object { | ||
"type": "StringLiteral", | ||
"value": "test", | ||
}, | ||
"static": true, | ||
"type": "ClassProperty", | ||
"typeAnnotation": null, | ||
"value": Object { | ||
"type": "NumericLiteral", | ||
"value": 1, | ||
}, | ||
} | ||
`; |
27 changes: 27 additions & 0 deletions
27
packages/babel-types/test/builders/experimental/classProperty.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 @@ | ||
import * as t from "../../.."; | ||
|
||
describe("builders", function() { | ||
describe("experimental", function() { | ||
describe("classProperty", function() { | ||
it("should validate", function() { | ||
expect( | ||
t.classProperty( | ||
t.stringLiteral("test"), | ||
t.numericLiteral(1), | ||
), | ||
).toMatchSnapshot(); | ||
|
||
expect( | ||
t.classProperty( | ||
t.stringLiteral("test"), | ||
t.numericLiteral(1), | ||
null, | ||
null, | ||
false, | ||
true | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
}); |