web 3d图形渲染器
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
685 B

  1. /**
  2. * @flow
  3. */
  4. import JSXAttributeMock from './JSXAttributeMock';
  5. export type TJSXElementMock = {
  6. type: 'JSXElement',
  7. openingElement: {
  8. type: 'JSXOpeningElement',
  9. name: {
  10. type: 'JSXIdentifier',
  11. name: string,
  12. },
  13. attributes: Array<JSXAttributeMock>,
  14. },
  15. children: Array<Node>,
  16. };
  17. export default function JSXElementMock(
  18. tagName: string,
  19. attributes: Array<JSXAttributeMock> = [],
  20. children: Array<Node> = [],
  21. ): TJSXElementMock {
  22. return {
  23. type: 'JSXElement',
  24. openingElement: {
  25. type: 'JSXOpeningElement',
  26. name: {
  27. type: 'JSXIdentifier',
  28. name: tagName,
  29. },
  30. attributes,
  31. },
  32. children,
  33. };
  34. }