fix(grid): show comments for joined query results

This commit is contained in:
jearhe authored and GitHub committed 2026-08-16 15:34:03 +08:00
1 parent d5f18034f9
commit 64e5e88c27
11 files changed
+867 -9

No files matched your search

@@ -4,8 +4,10 @@ import { describe, expect, it } from "vitest";
const dataGridSource = readFileSync(new URL("../DataGrid.vue", import.meta.url), "utf8");
describe("DataGrid column comments", () => {
it("uses source column metadata for both inline and tooltip header comments", () => {
expect(dataGridSource).toMatch(/function resolvedColumnComment\(column: string, actualColIdx: number\)[\s\S]*?dataGridColumnCommentFor\([\s\S]*?props\.sourceColumns\?\.\[actualColIdx\][\s\S]*?\);\s*\}/);
it("uses per-ordinal multi-source comments, falling back to source metadata for single-source grids", () => {
expect(dataGridSource).toMatch(
/function resolvedColumnComment\(column: string, actualColIdx: number\)[\s\S]*?const ordinalComments = props\.resultColumnComments;[\s\S]*?if \(ordinalComments\) return ordinalComments\[actualColIdx\];[\s\S]*?dataGridColumnCommentFor\([\s\S]*?props\.sourceColumns\?\.\[actualColIdx\][\s\S]*?\);\s*\}/,
);
expect(dataGridSource).toContain(':column-comment="headerColumnComment(col.name, col.actualColIdx)"');
expect(dataGridSource).toContain(':tooltip-column-comment="resolvedColumnComment(col.name, col.actualColIdx)"');
expect(dataGridSource).toContain("(column, index) => headerColumnComment(column, index)");