{ const canvas = within(canvasElement); await userEvent.click(canvas.getByRole("button", { name: "Leave a reply..." })); const textarea = await waitFor(() => canvas.getByPlaceholderText(/write a reply/i)); await expect(canvas.getByRole("button", { name: "Reply" })).toBeInTheDocument(); await expect(canvas.getByRole("button", { name: "Cancel" })).toBeInTheDocument(); // the editor should be focused so the user can type immediately await waitFor(() => expect(textarea).toHaveFocus()); }} > {#snippet template(args)} {/snippet} { const canvas = within(canvasElement); await userEvent.click(canvas.getByRole("button", { name: "Edit comment" })); const textarea = await waitFor(() => canvas.getByPlaceholderText(/edit your comment/i)); await expect(textarea).toHaveValue(sampleComments.mine.body); await expect(canvas.getByRole("button", { name: "Save" })).toBeInTheDocument(); await expect(canvas.getByRole("button", { name: "Cancel" })).toBeInTheDocument(); }} > {#snippet template(args)} {/snippet}