feat(core,view): input cards with change tracking (plan B1 · C2)
- Three values per pier: defaults (as imported), input (generated), draft (current cards). Overrides = draft vs defaults; pending = draft vs input. - Editable now: 코핑 폭, 코핑 길이, 말뚝 길이. Changing a card does not touch the 3D view until 다시 생성; the header and the card show 변경 n. - Revert puts a field back to its imported default. - Project files store defaults and draft (optional; v1 files still open). - Tests: 코핑 폭 3100 → 3300 gives one override and one pending change; regenerating clears pending but keeps the override; revert; file round trip. - Not verified in a browser (no debuggable Chrome in this session). Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5303e4c2b
commit
0b62f694c5
7 files changed
+239
-9
No files matched your search
@@ -46,4 +46,21 @@ describe('project file round trip (spec §8, plan B3)', () => {
|
||||
expect(() => parseProject(JSON.stringify(broken))).toThrow('교각 2');
|
||||
expect(() => parseProject('{ not json')).toThrow('JSON');
|
||||
});
|
||||
|
||||
it('keeps defaults and an unregenerated draft through save and open', () => {
|
||||
const original = sampleProject();
|
||||
const p1 = original.piers[0];
|
||||
original.piers[0] = { ...p1, defaults: p1.input, draft: { ...p1.input, copingWidthMm: 3300 } };
|
||||
const reopened = parseProject(serializeProject(original));
|
||||
expect(reopened.piers[0].draft?.copingWidthMm).toBe(3300);
|
||||
expect(reopened.piers[0].input.copingWidthMm).toBe(3100);
|
||||
});
|
||||
|
||||
it('a file saved before change tracking (no defaults or draft) still opens', () => {
|
||||
const legacy = sampleProject();
|
||||
const text = JSON.stringify({ ...legacy, piers: legacy.piers.map((p) => ({ id: p.id, input: p.input })) });
|
||||
const reopened = parseProject(text);
|
||||
expect(reopened.piers[0].defaults).toBeUndefined();
|
||||
expect(reopened.piers[0].draft).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user