feat(ui-calculator): input validation, load caps, ceil display, modernization layout
- custom load capped at cargo capacity (error when exceeded); full load shows the cargo capacity; zero cargo pins load to empty and disables the toggle - per-input red border + tooltip for every invalid value (blocks, techs, load, MAT, modernization target); no value may be negative; locking a speed is disabled when drive is zero - display every computed number (results + goal-seek back-solved input) rounded up to 3 decimals via a shared pkg/calc Ceil3 bridged to wasm; engine keeps its own round-to-nearest util.Fixed* - modernization total upgrade cost spans two columns (single line) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,4 +70,10 @@ describe("WasmCore calculator bridge (Phase 30)", () => {
|
||||
core.driveForSpeed({ targetSpeed: 100, driveTech: 1.2, restMass: 35 }),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
test("ceil3 rounds up to three decimals", () => {
|
||||
expect(core.ceil3({ value: 5.0003 })).toBeCloseTo(5.001, 9);
|
||||
expect(core.ceil3({ value: 4.2761 })).toBeCloseTo(4.277, 9);
|
||||
expect(core.ceil3({ value: 5 })).toBeCloseTo(5, 9);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user