fix(grid): show load time with one decimal in all states

This commit is contained in:
zipg authored and GitHub committed 2026-09-28 13:13:52 +08:00
1 parent 6ce402f26b
commit 403da04d1f
3 files changed
+20 -11

No files matched your search

@@ -19,16 +19,16 @@ describe("DataGridBusyOverlay", () => {
it("shows the elapsed seconds without a stop action by default", () => {
const mounted = mountComponent(DataGridBusyOverlay, { elapsedMs: 12_340 });
expect(hostText(mounted.root)).toContain("12.34s");
expect(hostText(mounted.root)).toContain("12.3s");
expect(findCancelButton(mounted.root)).toHaveLength(0);
});
it("formats long waits and guards non-finite elapsed values", async () => {
const mounted = mountComponent(DataGridBusyOverlay, { elapsedMs: 312_450 });
expect(hostText(mounted.root)).toContain("312.45s");
expect(hostText(mounted.root)).toContain("312.4s");
await mounted.setProps({ elapsedMs: Number.NaN });
expect(hostText(mounted.root)).toContain("0.00s");
expect(hostText(mounted.root)).toContain("0.0s");
});
it("stops the running load from the elapsed pill", () => {
@@ -70,7 +70,7 @@ describe("DataGridBusyOverlay", () => {
expect(hostText(mounted.root)).toContain("grid.pageJumpLoading");
expect(hostText(mounted.root)).toContain("grid.pageJumpProgress");
expect(hostText(mounted.root)).toContain("45.00s");
expect(hostText(mounted.root)).toContain("45.0s");
const progressbar = findOne(mounted.root, (node) => node.props.role === "progressbar");
expect(progressbar.props["aria-valuenow"]).toBe(3);
expect(progressbar.props["aria-valuemax"]).toBe(12);