GoScrobble/web/node_modules/eslint-plugin-jsx-a11y/__mocks__/JSXElementMock.js

38 lines
685 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
/**
* @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,
};
}