| 523 | } |
| 524 | |
| 525 | export 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 | |
| 548 | export async function hoverControlWithCheck( |
| 549 | editor: EditorRenderResult, |