|
| 1 | +## Test Cases |
| 2 | + |
| 3 | +### Reproduction Tests |
| 4 | + |
| 5 | +- Attribute number with default export type uses formatter - (unit) |
| 6 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: true, decimalPrecision: 2 } }` |
| 7 | + - **When**: Export reads the cell |
| 8 | + - **Then**: Cell is `{ t: "n", v: 1234.56, z: "#,##0.00" }` |
| 9 | + |
| 10 | +- Attribute date with default export type uses custom pattern - (unit) |
| 11 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "datetime", config: { type: "custom", pattern: "dd/MM/yyyy" } }` |
| 12 | + - **When**: Export reads the cell |
| 13 | + - **Then**: Cell is `{ t: "d", v: <stripped-date>, z: "dd/mm/yyyy" }` (M→m converted for Excel) |
| 14 | + |
| 15 | +### Edge Cases |
| 16 | + |
| 17 | +- Attribute date with non-custom datetime config falls back to locale default - (unit) |
| 18 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "datetime", config: { type: "date" } }` |
| 19 | + - **When**: Export reads the cell |
| 20 | + - **Then**: Cell has `z: "dd-mm-yyyy"` (locale fallback, not derived from formatter) |
| 21 | + |
| 22 | +- Attribute number with no decimal precision - (unit) |
| 23 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: false, decimalPrecision: 0 } }` |
| 24 | + - **When**: Export reads the cell |
| 25 | + - **Then**: Cell has `z: "0"` (no grouping, no decimals) |
| 26 | + |
| 27 | +- Attribute with formatter lacking type field - (unit) |
| 28 | + - **Given**: Attribute column with `exportType = "default"`, attribute has basic formatter (no `type` property, e.g., default mock) |
| 29 | + - **When**: Export reads the cell |
| 30 | + - **Then**: Cell has `z: undefined` for numbers, locale fallback for dates (graceful degradation) |
| 31 | + |
| 32 | +### Regression Tests |
| 33 | + |
| 34 | +- Custom export type still uses explicit format - (unit) |
| 35 | + - **Given**: Attribute column with `exportType = "number"` and `exportNumberFormat = "#,##0.00"` |
| 36 | + - **When**: Export reads the cell |
| 37 | + - **Then**: Cell uses the explicit format, NOT the attribute formatter |
| 38 | + |
| 39 | +- Dynamic text always exports as string regardless of export settings - (unit) |
| 40 | + - **Given**: Dynamic text column with any `exportType` set |
| 41 | + - **When**: Export reads the cell |
| 42 | + - **Then**: Cell is always `{ t: "s" }`, export type ignored |
| 43 | + |
| 44 | +- Custom content export unchanged - (unit) |
| 45 | + - **Given**: Custom content column with `exportType = "number"` and `exportValue = "1234.56"` |
| 46 | + - **When**: Export reads the cell |
| 47 | + - **Then**: Cell is `{ t: "n", v: 1234.56, z: <format> }` (same as before) |
| 48 | + |
| 49 | +## Notes |
| 50 | + |
| 51 | +- The `M → m` conversion is needed because Mendix uses Java-style date patterns (M = month) while Excel uses `m` for month. |
| 52 | +- `getAttributeDefaultFormat` returns `undefined` for string, boolean, and enum attributes — these fall through to existing logic (displayValue for strings, native boolean cells). |
| 53 | +- The `editorConfig` change is Studio Pro-only (design time) — no runtime test needed. |
0 commit comments