Skip to content

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 ​

ParameterTypeDescription
styleUnderlineStyleOptional 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 ​

RegionSupported
term.cell(r, c)Yes
term.screenNo
term.row(n)No

Notes ​

  • Without a style argument, matches any underline style
  • Curly underline is commonly used for spell-check indicators
  • Not all terminal backends support all underline styles

See Also ​