mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
38 lines
685 B
JavaScript
38 lines
685 B
JavaScript
/**
|
|
* @flow
|
|
*/
|
|
|
|
import JSXAttributeMock from './JSXAttributeMock';
|
|
|
|
export type TJSXElementMock = {
|
|
type: 'JSXElement',
|
|
openingElement: {
|
|
type: 'JSXOpeningElement',
|
|
name: {
|
|
type: 'JSXIdentifier',
|
|
name: string,
|
|
},
|
|
attributes: Array<JSXAttributeMock>,
|
|
},
|
|
children: Array<Node>,
|
|
};
|
|
|
|
export default function JSXElementMock(
|
|
tagName: string,
|
|
attributes: Array<JSXAttributeMock> = [],
|
|
children: Array<Node> = [],
|
|
): TJSXElementMock {
|
|
return {
|
|
type: 'JSXElement',
|
|
openingElement: {
|
|
type: 'JSXOpeningElement',
|
|
name: {
|
|
type: 'JSXIdentifier',
|
|
name: tagName,
|
|
},
|
|
attributes,
|
|
},
|
|
children,
|
|
};
|
|
}
|