Uh oh!
There was an error while loading. Please reload this page.
docs(tests): add tests/README.md and stable ForEach / LazyLoad / VirtualScroll tests - #24
Merged
joaodibba merged 2 commits intoJun 15, 2026
Conversation
…croll tests - Add tests/README.md documenting npm run test, npm run test:run, the render() helper in tests/utils.ts, setup.ts behavior, and recommended assertion patterns including happy-dom limitations. - Add tests/async-components.test.ts covering: * ForEach: construction, attribute handling, apply() contract, and notes on why HTML-template rendering requires an HTML fixture (the #content capture is commented out in the current source). * LazyLoad: construction with and without loader, loaderProps storage, Component.lazyLoad invocation via the onConnected event path, and notes on why IntersectionObserver tests need a real browser. * VirtualScroll: construction, inner container height/position, overflow style, initial render slice under happy-dom (scrollTop=0 collapses the window to [0, buffer)), renderItem factory invocation, absolute positioning of rendered items, and a skipped describe block documenting the scroll-windowing tests deferred to E2E. All 209 tests pass; 1 test skipped with explanation.
…ise pattern comments
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes two deferred roadmap items from PR #15:
tests/README.md— contributor documentation for the test suite.tests/async-components.test.ts— stable tests forForEach,LazyLoad, andVirtualScroll.What's in each file
tests/README.mdnpm run test(watch) vsnpm run test:run(CI)tests/, what each one teststests/utils.tsrender helperrender()signature, auto-cleanup, exampletests/setup.tsMemoryStoragepolyfill,beforeEachstorage clearvitest.config.tsreferencetests/async-components.test.tsForEach (11 tests): custom element tag, empty innerHTML,
itemgetter default,ofsetter/getAttribute round-trip,apply()no-throw and innerHTML-clear contract.LazyLoad (11 tests): custom element tag,
loader/loaderPropsstored correctly,Component.lazyLoadspy asserts it is called with correctfallback/propsononConnected, not called when no loader provided.VirtualScroll (13 tests, 1 skipped): custom element tag, inner container presence and
position: relative, total height =items.length × itemHeight,overflow-y: auto, initial render slice under happy-dom (scrollTop=0→bufferitems), custombuffer, empty items, absolute positioning + pxtop+100% width,renderItemfactory call count,top = index × itemHeight, scroll event no-throw. Scroll-position windowing skipped with a note pointing to E2E.Validation
All pre-existing tests continue to pass.
Reviewers
@zico15