Skip to content

Commit 45c6730

Browse files
test(datagrid-web): cover whitespace number fallback and unavailable dynamicText
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9724db3 commit 45c6730

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

packages/pluggableWidgets/datagrid-web/src/features/data-export/__tests__/cell-readers.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ describe("cell-readers", () => {
121121
const cell = readSingleCell(col);
122122
expect(cell).toEqual({ t: "s", v: "" });
123123
});
124+
125+
it("returns n/a cell when dynamicText is unavailable", () => {
126+
const col = column("Label", c => {
127+
c.showContentAs = "dynamicText";
128+
c.dynamicText = listExpression(() => "text", "unavailable");
129+
});
130+
const cell = readSingleCell(col);
131+
expect(cell.t).toBe("s");
132+
expect(cell.v).toBe("n/a");
133+
});
124134
});
125135

126136
describe("customContent reader", () => {
@@ -192,6 +202,17 @@ describe("cell-readers", () => {
192202
expect(cell.v).toBe("");
193203
});
194204

205+
it("falls back to string for whitespace-only value with number exportType", () => {
206+
const col = column("Ws", c => {
207+
c.showContentAs = "customContent";
208+
c.exportValue = listExpression(() => " ");
209+
c.exportType = "number";
210+
});
211+
const cell = readSingleCell(col);
212+
expect(cell.t).toBe("s");
213+
expect(cell.v).toBe(" ");
214+
});
215+
195216
it("exports as date cell when exportType is date", () => {
196217
const col = column("Created", c => {
197218
c.showContentAs = "customContent";

0 commit comments

Comments
 (0)