FakeClipboard
A recording ClipboardPort.
This is a class exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { FakeClipboard } from "@mapcairn/core";
class FakeClipboard implements ClipboardPort
Description
How to script it: it succeeds by default. failWith(reason) makes every
later copy resolve to { ok: false, reason } and succeed() restores
success. written holds the text of copies that succeeded and attempts
the text of every call. It never rejects.
Properties
attempts
readonly attempts: string[];
The text of every call, whether it succeeded or not, in order.
written
readonly written: string[];
The text of every copy that succeeded, in order.
Methods
failWith
failWith(reason: ClipboardFailureReason): void;
Makes every later copy fail for this reason.
reason(ClipboardFailureReason)
succeed
succeed(): void;
Makes every later copy succeed.
writeText
writeText(text: string): Promise<ClipboardResult>;
Records the text in attempts, and in written too unless a failure is scripted. It resolves to a result and never rejects.
text(string)