the-forest/client/node_modules/eslint-plugin-jsx-a11y/__mocks__/JSXElementMock.js
2024-09-17 20:35:18 -04:00

38 lines
713 B
JavaScript

/**
* @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,
};
}