import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; const surface = readFileSync( new URL("../Sources/CottonUI/Surfaces/RecordListSurface.swift", import.meta.url), "utf8", ); describe("the record grid has one lazy layout across all sections", () => { // RULE: A paged grid shares one lazy layout across its section headers and records. it("does not give each month an independently estimated scroll height", () => { // Sibling month grids repeatedly revise each other's placement during a // fast scroll; the LARGE Notes walk stalled in LazySubviewPlacements. expect(surface).not.toMatch(/PaperCollection\(shown\(section\)/); expect(surface).toContain("private func sectionedGrid("); const grid = surface.slice(surface.indexOf("private func sectionedGrid(")); expect(grid.indexOf("LazyVGrid(")).toBeLessThan(grid.indexOf("ForEach(")); expect(grid).toContain("Section {"); expect(grid).toContain("nextPage(model)"); }); });