toHaveUnderline
Deprecated
Prefer toHaveAttrs which checks multiple attributes at once:
typescript
expect(term.cell(0, 0)).toHaveAttrs({ underline: true })Assert that a cell has underline styling. Optionally check for a specific underline style.
Signature
typescript
expect(cell).toHaveUnderline(style?: UnderlineStyle)Parameters
| Parameter | Type | Description |
|---|---|---|
style | UnderlineStyle | Optional specific style to check |
UnderlineStyle: "single" | "double" | "curly" | "dotted" | "dashed"
Usage
typescript
// Any underline
expect(term.cell(0, 0)).toHaveUnderline()
// Specific underline style
expect(term.cell(0, 0)).toHaveUnderline("single")
expect(term.cell(0, 0)).toHaveUnderline("curly") // spell-check style
expect(term.cell(0, 0)).toHaveUnderline("double")
expect(term.cell(0, 0)).toHaveUnderline("dotted")
expect(term.cell(0, 0)).toHaveUnderline("dashed")
// Negation
expect(term.cell(0, 0)).not.toHaveUnderline()Accepts
| Region | Supported |
|---|---|
term.cell(r, c) | Yes |
term.screen | No |
term.row(n) | No |
Notes
- Without a
styleargument, matches any underline style - Curly underline is commonly used for spell-check indicators
- Not all terminal backends support all underline styles
See Also
- toHaveAttrs - composable attribute matcher (preferred)
- toBeBold - bold styling
- toBeItalic - italic styling
- toBeStrikethrough - strikethrough styling