What problem does this solve?
packages/widgets/src/data/TableState.ts exports useTableState — a state
hook managing row data and scroll offset for the Table widget. It has
no test file despite containing boundary logic in setRows, scrollPrev,
and scrollNext that could silently regress.
Proposed solution
Create packages/widgets/src/data/TableState.test.ts covering:
- useTableState initializes with provided rows
- useTableState initializes scrollOffset to 0
- setRows() updates rows
- setRows() clamps scrollOffset when new rows list is shorter
- setRows() keeps scrollOffset when still valid
- setRows() handles empty rows and resets scrollOffset to 0
- scrollNext() increments scrollOffset
- scrollPrev() decrements scrollOffset
- scrollPrev() does not go below 0
Which package would this belong in?
@termuijs/widgets — packages/widgets/src/data/TableState.test.ts
GSSoC contributor?
What problem does this solve?
packages/widgets/src/data/TableState.ts exports useTableState — a state
hook managing row data and scroll offset for the Table widget. It has
no test file despite containing boundary logic in setRows, scrollPrev,
and scrollNext that could silently regress.
Proposed solution
Create packages/widgets/src/data/TableState.test.ts covering:
Which package would this belong in?
@termuijs/widgets — packages/widgets/src/data/TableState.test.ts
GSSoC contributor?