dotnet / dotnet/aspnetcore

Add comprehensive unit tests for Virtualize.ts JavaScript module

Open
#67,029 1 comment 0 reactions 0 assignees View on GitHub
area-blazor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

## Issue

`Virtualize.test.ts` currently has only 14 lines — it checks that export symbols exist but has zero behavioral test coverage. The `Virtualize.ts` module (766 lines, complexity 139) is the JavaScript counterpart to the Blazor Virtualize component and has no direct unit tests.

## What's Missing

- No tests for guard clauses when spacers are disconnected
- No tests for IntersectionObserver/ResizeObserver setup
- No tests for overflow-anchor style management
- No tests for scroll container detection
- No tests for event listener registration (Home/End keys, scroll)
- No tests for dispose lifecycle
- No tests for any exported functions (scrollToBottom, refreshObservers, setAnchorMode, etc.)

Found via static analysis — Virtualize.ts had complexity 139 and 0% direct JS test coverage.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.