fix(grid): clear stale header context menu targets

Closes #6869
This commit is contained in:
t8y2 committed 2026-08-22 03:50:15 +00:00
1 parent 62657446f3
commit f3d2b6cb01
3 files changed
+135 -21

No files matched your search

+24
View File
@@ -35,6 +35,30 @@ test("column-header context menus defer copy statement generation", () => {
assert.doesNotMatch(handler, /prefetchCopyStatements/);
});
test("context-menu invalidation clears cell and header targets together", () => {
const handler = dataGridSource.match(/function invalidateContextMenuTarget\(\) \{[^]*?\n\}/)?.[0] ?? "";
assert.match(handler, /contextSelectionIsSynthetic\.value = false;/);
assert.match(handler, /contextCell\.value = null;/);
assert.match(handler, /contextHeaderColumn\.value = null;/);
assert.match(handler, /contextHeaderColumnIndex\.value = null;/);
assert.match(handler, /contextHeaderVisibleColIdx\.value = null;/);
});
test("select-all context menus invalidate a stale specialized target", () => {
const header = dataGridSource.match(/<div\s+class="data-grid-header-cell shrink-0 px-2 py-1\.5[^]*?@click="selectAllCells"[^]*?>/u)?.[0] ?? "";
assert.match(header, /@contextmenu="invalidateContextMenuTarget"/);
});
test("menu-close invalidation is deferred and guarded from a newer open", () => {
const handler = dataGridSource.match(/function onGridContextMenuClose\(\) \{[^]*?\n\}/)?.[0] ?? "";
assert.match(handler, /queueMicrotask\(\(\) => \{/);
assert.match(handler, /if \(lifecycle !== contextMenuLifecycle\) return;/);
assert.match(handler, /invalidateContextMenuTarget\(\);/);
});
test("editable cell selections expose generation after bulk edit", () => {
const icon = {};
const action = () => {};