-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
91 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Connected Components React Plugin - Functional ComponentWithChildren.jsx snippet creation 1`] = ` | ||
Object { | ||
"description": "", | ||
"lang": "jsx", | ||
"snippet": "<MyComponent> | ||
{children} | ||
</MyComponent>", | ||
} | ||
`; | ||
|
||
exports[`Connected Components React Plugin - Functional FunctionalComponents.jsx snippet creation 1`] = ` | ||
Object { | ||
"description": "", | ||
"lang": "jsx", | ||
"snippet": "<MyComponent />", | ||
} | ||
`; |
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,29 @@ | ||
import Plugin from "../src"; | ||
|
||
describe("Connected Components React Plugin - Functional", () => { | ||
test("FunctionalComponents.jsx snippet creation", async () => { | ||
const plugin = new Plugin(); | ||
|
||
const componentCode = await plugin.process( | ||
{ | ||
path: "test/samples/jsx-functional/FunctionalComponent.jsx", | ||
zeplinNames: [] | ||
} | ||
); | ||
|
||
expect(componentCode).toMatchSnapshot(); | ||
}); | ||
|
||
test("ComponentWithChildren.jsx snippet creation", async () => { | ||
const processor = new Plugin(); | ||
|
||
const componentCode = await processor.process( | ||
{ | ||
path: "test/samples/jsx-functional/FunctionalComponentWithChildren.jsx", | ||
zeplinNames: [] | ||
} | ||
); | ||
|
||
expect(componentCode).toMatchSnapshot(); | ||
}); | ||
}); |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
import React from 'react'; | ||
|
||
const MyComponent = () => { | ||
const thing = { | ||
stuff: 'stuff', | ||
}; | ||
|
||
const string = thing?.stuff; | ||
|
||
return ( | ||
<div> | ||
{string} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MyComponent; |
21 changes: 21 additions & 0 deletions
21
test/samples/jsx-functional/FunctionalComponentWithChildren.jsx
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,21 @@ | ||
import React from 'react'; | ||
|
||
const MyComponent = () => { | ||
const thing = { | ||
stuff: 'stuff', | ||
}; | ||
|
||
const string = thing?.stuff; | ||
|
||
return ( | ||
<div> | ||
{string} | ||
</div> | ||
); | ||
}; | ||
|
||
MyComponent.propTypes = { | ||
children: PropTypes.element.isRequired | ||
}; | ||
|
||
export default MyComponent; |