MCPcopy
hub / github.com/concrete-utopia/utopia / selectComponentsForTest

Function selectComponentsForTest

editor/src/utils/utils.test-utils.tsx:525–546  ·  view source on GitHub ↗
(
  editor: EditorRenderResult,
  paths: Array<ElementPath>,
)

Source from the content-addressed store, hash-verified

523}
524
525export async function selectComponentsForTest(
526 editor: EditorRenderResult,
527 paths: Array<ElementPath>,
528): Promise<void> {
529 for (const path of paths) {
530 const element = MetadataUtils.findElementByElementPath(
531 editor.getEditorState().editor.jsxMetadata,
532 path,
533 )
534 if (element == null) {
535 const underlyingElement = toFirst(
536 editorStateToElementChildOptic(path),
537 editor.getEditorState().editor,
538 )
539 forEachLeft(underlyingElement, () => {
540 throw new Error(`Could not find ${EP.toString(path)} in metadata or in project contents.`)
541 })
542 }
543 }
544 await editor.dispatch([selectComponents(paths, false)], true)
545 await editor.getDispatchFollowUpActionsFinished()
546}
547
548export async function hoverControlWithCheck(
549 editor: EditorRenderResult,

Calls 5

toFirstFunction · 0.90
forEachLeftFunction · 0.90
selectComponentsFunction · 0.90
toStringMethod · 0.80

Tested by 15

testCaseElementInBackFunction · 0.72
testCaseElementOnTopFunction · 0.72
testCaseElementInFrontFunction · 0.72
runCellResizeTestFunction · 0.72
testGridOutlinesFunction · 0.72
doTestFunction · 0.72
getGlobalFrameFunction · 0.72
doGroupFunction · 0.72
setupFunction · 0.72
runPasteFunction · 0.72