fix(grid): keep row copy actions consistent after refresh

This commit is contained in:
zipg authored and GitHub committed 2026-08-05 01:10:57 +08:00
1 parent 27d72f8776
commit be2590347f
6 files changed
+138 -7

No files matched your search

@@ -0,0 +1,14 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const dataGridSource = readFileSync(new URL("../../../components/grid/DataGrid.vue", import.meta.url), "utf8");
describe("DataGrid context menu state", () => {
it("clears the context target whenever the result is replaced", () => {
expect(dataGridSource).toMatch(/watch\(\s*\(\) => props\.result,[\s\S]*?clearRowSelection\(\);\s*invalidateSyntheticContextSelection\(\);[\s\S]*?exitTransaction\(\);/);
});
it("uses the actual copyable row count in the copy menu", () => {
expect(dataGridSource).toContain('label: copyRowCount.value > 1 ? t("grid.copyRows", { count: copyRowCount.value }) : t("grid.copyRow")');
});
});