fix(mongo): stabilize estimated-total pagination

This commit is contained in:
Freedom authored and GitHub committed 2026-07-31 14:51:25 +08:00
1 parent 96038d2b8a
commit 8f3fd0ebfb
23 files changed
+462 -124

No files matched your search

@@ -212,6 +212,10 @@ describe("DataGridPagination", () => {
expect(previousPage).toHaveBeenCalledOnce();
expect(nextPage).toHaveBeenCalledOnce();
expect(lastPage).toHaveBeenCalledOnce();
await mounted.setProps({ loading: true });
const busyNavigation = findAll(mounted.root, (node) => node.props["data-stub"] === "Button" && node.props.class === "h-5 w-5 shrink-0");
expect(busyNavigation.map((node) => node.props.disabled)).toEqual([true, true, true, true]);
});
it("hides pagination controls when the data source does not support paging", () => {
@@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
import { dataGridTotalRowCountLabelKey } from "@/lib/dataGrid/dataGridPagination";
import DataGrid from "../DataGrid.vue";
type VuePropDefinition = { default?: unknown };
@@ -8,5 +9,12 @@ describe("DataGrid total row count exactness", () => {
it("treats totals as exact unless a caller explicitly marks them as a lower bound", () => {
const component = DataGrid as unknown as VueComponentWithProps;
expect(component.props?.totalRowCountIsExact?.default).toBe(true);
expect(component.props?.inexactTotalRowCountMode?.default).toBe("at-least");
});
it("keeps lower-bound and estimated total labels distinct", () => {
expect(dataGridTotalRowCountLabelKey(true, "estimated")).toBe("grid.totalRowCount");
expect(dataGridTotalRowCountLabelKey(false, "at-least")).toBe("grid.totalRowCountAtLeast");
expect(dataGridTotalRowCountLabelKey(false, "estimated")).toBe("grid.totalRowCountEstimated");
});
});