web: Fix failing tests

This commit is contained in:
2025-09-09 12:05:01 -05:00
parent 1c821dde14
commit 5fbf9af286
2 changed files with 16 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ test("generateTableColumns", () => {
headerSort: false,
headerWordWrap: true,
hozAlign: "left",
minWidth: 75,
minWidth: 80,
resizable: false,
title: "1",
});

View File

@@ -12,7 +12,11 @@ import {
} from "tabulator-tables";
import { ValidationError } from "../../../core/Data/validate";
import Papa from "papaparse";
import { parseBool, parseNumber } from "../../../core/Operations/commonOps";
import {
parseBool,
parseNullableNumber,
parseNumber,
} from "../../../core/Operations/commonOps";
import { UnitCommitmentScenario } from "../../../core/Data/types";
export interface ColumnSpec {
@@ -243,6 +247,12 @@ export const parseCsv = (
data[name][spec.title] = val;
break;
}
case "number?": {
const [val, err] = parseNullableNumber(row[spec.title]);
if (err) return [null, { message: err.message + rowRef }];
data[name][spec.title] = val;
break;
}
case "busRef":
const busName = row[spec.title];
if (!(busName in scenario.Buses)) {
@@ -421,10 +431,10 @@ const DataTable = (props: DataTableProps) => {
// Restore active cell selection
if (activeCell) {
const cell = tableRef.current
.getRowFromPosition(activeRowPosition!!)
.getCell(activeField!!);
cell.edit();
tableRef.current
?.getRowFromPosition(activeRowPosition!!)
?.getCell(activeField!!)
?.edit();
}
// Update columns