test(web): add 23 edge-case tests across UI components and lib utils
Covers: aria-sort/aria-labelledby attributes, non-Error throws in ErrorBoundary, NaN/MAX_SAFE_INTEGER in formatCents, invalid dates, carriage returns in CSV, self-closing HTML tags in sanitize, non-digit input in DateInput, panel-click-not-dismissing in ConfirmDialog, role="search" on FilterBar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,4 +126,21 @@ describe("generateCsv", () => {
|
||||
expect(lines[1]).toBe("abc");
|
||||
expect(lines[2]).toBe("abc");
|
||||
});
|
||||
|
||||
it("does NOT quote a cell value that contains only a carriage return (\\r is not in the escape list)", () => {
|
||||
// The escapeCsvValue function checks for '\n' but not '\r'.
|
||||
// A bare \r is therefore left unquoted.
|
||||
const crCols = [{ header: "Field", accessor: (_r: unknown) => "line1\rline2" }];
|
||||
const csv = generateCsv([{}], crCols);
|
||||
const dataLine = csv.split("\n")[1];
|
||||
// Because \r is not special-cased, the value is NOT wrapped in quotes
|
||||
expect(dataLine).toBe("line1\rline2");
|
||||
});
|
||||
|
||||
it("empty columns array produces just a newline for no rows", () => {
|
||||
// header = "" (no columns), body = "" (no rows)
|
||||
// result = "" + "\n" + "" = "\n"
|
||||
const csv = generateCsv([], []);
|
||||
expect(csv).toBe("\n");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user