You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
713 B
37 lines
713 B
/** |
|
* @flow |
|
*/ |
|
|
|
import type { JSXAttributeMockType } from './JSXAttributeMock'; |
|
|
|
export type JSXElementMockType = { |
|
type: 'JSXElement', |
|
openingElement: { |
|
type: 'JSXOpeningElement', |
|
name: { |
|
type: 'JSXIdentifier', |
|
name: string, |
|
}, |
|
attributes: Array<JSXAttributeMockType>, |
|
}, |
|
children: Array<Node>, |
|
}; |
|
|
|
export default function JSXElementMock( |
|
tagName: string, |
|
attributes: Array<JSXAttributeMockType> = [], |
|
children?: Array<Node> = [], |
|
): JSXElementMockType { |
|
return { |
|
type: 'JSXElement', |
|
openingElement: { |
|
type: 'JSXOpeningElement', |
|
name: { |
|
type: 'JSXIdentifier', |
|
name: tagName, |
|
}, |
|
attributes, |
|
}, |
|
children, |
|
}; |
|
}
|
|
|