toHaveClipboardText
Assert that the terminal has captured specific text via OSC 52 clipboard write.
Signature
typescript
expect(term).toHaveClipboardText(text: string)Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Expected clipboard text |
Usage
typescript
// Assert clipboard content after an OSC 52 write
expect(term).toHaveClipboardText("copied text")
// Negation
expect(term).not.toHaveClipboardText("wrong text")Accepts
| Target | Supported |
|---|---|
term (Terminal with clipboardWrites) | Yes |
term.screen | No |
term.cell(r, c) | No |
Notes
- This matcher checks the
clipboardWritesarray on the Terminal object - OSC 52 is the escape sequence terminals use to set clipboard content
- The matcher checks if the text appears in any clipboard write, not just the most recent one
- Does not support auto-retry (no
timeoutoption)
See Also
- toHaveTitle - terminal title (also set via OSC)
- toBeInMode - terminal mode assertion