- view/bearing-section-svg.ts: the pair's elevation — blocks (일체: one stepped outline), mortar, bearing body and solplate per bearing from the model; the drawing heights overlaid dashed. EL.X at the mortar top, E = h1 + h2 + h3 + h4. - view/solplate-svg.ts: per bearing, the plan L × W and the taper T1 · T2 (S %), with the drawing values dashed. - ② bearing card: section figure and the two solplate figures under the plan. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { buildPier } from '../src/core/geometry';
|
|
import { bearingSectionSvg } from '../src/view/bearing-section-svg';
|
|
import { solplateDetailSvg } from '../src/view/solplate-svg';
|
|
import { loadP1 } from './helpers';
|
|
|
|
const model = buildPier(loadP1());
|
|
const integrated = buildPier({ ...loadP1(), bearingLayout: '일체' });
|
|
const ref = { h1: 150, h2: 50, h3: 181, h4: 30, E: 425, A: 700, B: 640 };
|
|
|
|
describe('교량받침 상세 단면 (승인 2026-10-26)', () => {
|
|
it('labels EL.X at the mortar top and the block height h1 for each bearing', () => {
|
|
const svg = bearingSectionSvg(model, 0);
|
|
expect(svg).toContain('EL.X');
|
|
expect(svg).toContain('h1 150');
|
|
});
|
|
|
|
it('draws the drawing heights dashed only when given', () => {
|
|
expect(bearingSectionSvg(model, 0)).not.toContain('stroke-dasharray="40 25"');
|
|
const svg = bearingSectionSvg(model, 0, { front: ref, back: ref });
|
|
expect((svg.match(/stroke-dasharray="40 25"/g) ?? []).length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('일체 draws one stepped outline (a polygon) for the pair', () => {
|
|
expect(bearingSectionSvg(integrated, 0)).toContain('<polygon');
|
|
});
|
|
|
|
it('an unknown pair gives an empty drawing', () => {
|
|
expect(bearingSectionSvg(model, 99)).toBe('');
|
|
});
|
|
});
|
|
|
|
describe('솔플레이트 상세 (승인 2026-10-26)', () => {
|
|
it('shows L, W, T1 and T2 of the model plan, with the drawing dashed when given', () => {
|
|
const withPlan = buildPier({ ...loadP1(), bearingPlans: [{ no: 1, A: 700, B: 640, S: -1.9 }] });
|
|
const block = withPlan.blocks.find((b) => b.no === 1)!;
|
|
const svg = solplateDetailSvg(block);
|
|
expect(svg).toContain('L ');
|
|
expect(svg).toContain('T1 ');
|
|
expect(svg).toContain('T2 ');
|
|
const withRef = solplateDetailSvg(block, { L: 800, W: 748, T1: 38, T2: 22, S: 1.9 });
|
|
expect(withRef).toContain('stroke-dasharray="40 25"');
|
|
});
|
|
});
|