`);
select(document.getElementById("link")!);
const copy = copyMenuFor(document.getElementById("link"))![0]!;
if ("run" in copy) copy.run?.();
await Promise.resolve();
expect(writeText).toHaveBeenCalledWith("Review changes");
});
it("offers no Copy Link Address on an anchor without a destination or with an in-page one", () => {
mount(`
`);
for (const id of ["anchor", "local"]) expect(copyMenuFor(document.getElementById(id))).toHaveLength(1);
});
it("offers a disabled Copy in a selectable pane with nothing selected", () => {
mount(`
`);
expect(copyMenuFor(document.getElementById("p")!.firstChild)).not.toBeNull();
});
it("offers Copy on a selection in any pane that opted in with its own CSS", () => {
mount(`
line 1
`);
select(document.getElementById("console")!);
expect(copyMenuFor(document.getElementById("console"))![0]).toMatchObject({ disabled: false });
});
it("stays out of chrome without a selection", () => {
mount(`
tree row
`);
expect(copyMenuFor(document.getElementById("b"))).toBeNull();
expect(copyMenuFor(document.getElementById("row"))).toBeNull();
});
it("ignores a selection elsewhere when right-clicking chrome", () => {
mount(`