test(grid): coverage for virtualization, compression math, viewport priority#74
Open
test(grid): coverage for virtualization, compression math, viewport priority#74
Conversation
…rt-Priority
Zieht die Test-Lücken nach, die in der mobile-scroll Session aufgefallen sind.
Refactor (minimaler Behavior-No-Op):
src/utils/gridLayout.js neu — pure Helper für Spacer-Math, Compression-
Ratio, kontinuierliche topSpacer-Formel, Viewport-First-Iterator.
GridView.vue importiert sie und delegiert; jsdom-Vitest kann jetzt
die Math direkt testen ohne Layout-Mocking.
Vitest +24:
- gridLayout.spec.js (20 Tests): spacerHeightForRows Edge-Cases,
Compression-Ratio Cap-Verhalten, topSpacer in beiden Modi inkl.
Continuity-Check (Δ Spacer = 1 - ratio bei Sub-Row-Scroll), Viewport-
First-Iterator komplett mit unshift-Semantik-Simulation.
- GridView.spec.js (4 Tests): ↑/↓ Tastatur-Nav steppt um columnsCount
Items (Bug-Wiederholungs-Schutz für den columnsEstimate-Fix), inkl.
Bottom-Edge-Clamp.
Cypress +3:
- mobile-virtualization.cy.js: 414×896 Viewport, prüft dass
Virtualisierung am Mobile-Viewport aktiv ist, scrollen den Render-
Range shiftet und topSpacer auftaucht. Spalten-Anzahl wird absichtlich
nicht asserted (NC-Mobile-UI-Verhalten variiert in Cypress).
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 free
to 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 the test gaps identified after the mobile-scroll session (#73). No behavior change in production code — pure refactor + new tests.
Refactor (no-op, single source of truth)
New
src/utils/gridLayout.jswith pure helpers extracted from `GridView.vue`:`GridView.vue` delegates to these. Existing 418 Vitest tests still green.
Vitest +24
`tests/js/gridLayout.spec.js` (20 tests)
`tests/js/GridView.spec.js` (4 tests)
Cypress +3
`tests/e2e/mobile-virtualization.cy.js` at viewport 414×896
Skips with log message if test folder has < 20 images. Column count is not asserted — Cypress' viewport setting controls `window.innerWidth` but NC's mobile UI behavior in iframe varies; the virtualization mechanism is what matters.
Test plan