Files
dbx/packages/app-tests/dataGridSelection.test.ts
T
t8y2 fabf2172e4 chore: migrate test runner from node:test/tsx to vitest
155 files, 1091 tests, 4.3s (2x faster than previous 9.1s).
2026-06-08 01:17:27 +08:00

33 lines
943 B
TypeScript

import { strict as assert } from "node:assert";
import { test } from "vitest";
import { computed, ref } from "vue";
import { useDataGridSelection } from "../../apps/desktop/src/composables/useDataGridSelection.ts";
test("cell selection does not read row data before a range exists", () => {
let displayItemsReads = 0;
const selection = useDataGridSelection({
columns: computed(() => ["id", "name"]),
displayItems: computed(() => {
displayItemsReads += 1;
return [
{
id: 0,
sourceIndex: 0,
data: [1, "Ada"],
isNew: false,
isDeleted: false,
isDirtyCol: [false, false],
status: "clean",
},
];
}),
editingCell: ref(null),
showTranspose: ref(false),
transposeRowIndex: ref(null),
gridRef: ref(undefined),
});
assert.equal(selection.hasCellSelection.value, false);
assert.equal(displayItemsReads, 0);
});