Answer stability round 1: 1 🔴, 4 🟡 (0 misread); assetHref in the test fakes, one shared buildContext option set, default pinned, upgrade note and AGENTS.md corrected
This commit is contained in:
@@ -59,7 +59,7 @@ test("buildPaginationModel maps a page to the pagination partial's model, every
|
||||
});
|
||||
});
|
||||
|
||||
test("buildPaginationModel disables the step off either end, keeps ellipses, and omits what wasn't asked for", () => {
|
||||
test("buildPaginationModel leaves prev/next without an href on the first/last page, keeps ellipses, and omits what wasn't asked for", () => {
|
||||
const m = buildPaginationModel(paginate(100, 1, 10), (n) => `/l?page=${n}`);
|
||||
assert.deepEqual(m.prev, {});
|
||||
assert.deepEqual(m.pages[m.pages.length - 2], { ellipsis: true });
|
||||
|
||||
+6
-5
@@ -1,7 +1,7 @@
|
||||
// paginate: pagination math → a PageModel. Pure and URL-free (README signature
|
||||
// `paginate(total, page, pageSize)`); buildPaginationModel then maps it, with the caller's
|
||||
// page → href function, to the model pagination.ejs renders. Inputs are clamped/guarded so it never
|
||||
// produces a broken model: page is pinned to [1, pageCount], total/pageSize coerced to sane integers.
|
||||
// `paginate(total, page, pageSize)`); buildPaginationModel maps it to pagination.ejs's model. Inputs
|
||||
// are clamped/guarded so it never produces a broken model: page is pinned to [1, pageCount],
|
||||
// total/pageSize coerced to sane integers.
|
||||
|
||||
export interface PageItem {
|
||||
current: boolean;
|
||||
@@ -47,8 +47,9 @@ export function paginate(total: number, page: number, pageSize: number, options:
|
||||
|
||||
export interface PaginationModelOptions {
|
||||
label?: string; // the nav's aria-label; the partial defaults it
|
||||
pageParam?: string; // as parseListQuery's options (default "page")
|
||||
pageSizeParam?: string; // as parseListQuery's options (default "pageSize")
|
||||
// The two query params, named as parseListQuery was given them; pageSizeParam names the rows field.
|
||||
pageParam?: string; // default "page"
|
||||
pageSizeParam?: string; // default "pageSize"
|
||||
pageSizes?: number[]; // the rows-per-page choices; omitted ⇒ no rows-per-page form
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user