feat(copy): 복사 항목 기본 체크를 기준 교각에서 바뀐 항목으로 설정
- 기준 교각의 되돌리기가 보이는 값에 해당하는 복사 항목을 자동으로 체크 - 기준 교각이나 부재가 바뀔 때만 다시 계산, 그 사이 사용자의 체크는 유지 - "변경 항목으로 선택" 버튼으로 언제든 같은 상태로 되돌림 - 바뀐 값이 없으면 아무 항목도 체크하지 않음 (적용 버튼 비활성) - copyItemsWithOverrides 추가, 테스트 4건 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70fa0be86f
commit
7314da639b
4 files changed
+54
-6
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { copyCandidates, copyItemsFor, selectedTargets, type CopyCandidate } from '../src/core/copy-targets';
|
||||
import { copyCandidates, copyItemsFor, copyItemsWithOverrides, selectedTargets, type CopyCandidate } from '../src/core/copy-targets';
|
||||
import { loadP1 } from './helpers';
|
||||
|
||||
const piers: CopyCandidate[] = [
|
||||
{ name: 'P1', type: 'T형', hasModel: true },
|
||||
@@ -63,3 +64,24 @@ describe('copyItemsFor (부재 선택에 해당하는 복사 항목)', () => {
|
||||
expect([...all].sort()).toEqual(['coping-length', 'coping-width', 'ground-position', 'pile-length', 'pile-rows']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('copyItemsWithOverrides (기준 교각에서 되돌리기가 표시된 항목)', () => {
|
||||
const base = loadP1();
|
||||
const source = (draft: Partial<typeof base>) => ({ defaults: base, input: base, draft: { ...base, ...draft } });
|
||||
|
||||
it('is empty when the 기준 pier has no changed values', () => {
|
||||
expect(copyItemsWithOverrides(source({}))).toEqual([]);
|
||||
});
|
||||
|
||||
it('selects the item of a changed coping length', () => {
|
||||
expect(copyItemsWithOverrides(source({ copingLengthMm: base.copingLengthMm + 500 }))).toEqual(['coping-length']);
|
||||
});
|
||||
|
||||
it('selects the pile item when the pile length changed', () => {
|
||||
expect(copyItemsWithOverrides(source({ pileLengthMm: base.pileLengthMm + 100 }))).toEqual(['pile-length']);
|
||||
});
|
||||
|
||||
it('ignores a changed value that no copy item carries (groundEl)', () => {
|
||||
expect(copyItemsWithOverrides(source({ groundEl: base.groundEl + 0.5 }))).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user