fix(848-3): 가져온 공식 줄 수만인 겹분수도 줄 나눔(두 층 안) · 칸 테두리 표시가 가짜 DOM 시험에서도 돎

- 산출근거 공식 묶음 — 기호 없는 식이라도 두 층 넘는 분수면 중간 줄 규칙으로(EST main 33 Q = (4.5 + 5.5) ÷ (2 × 0.35)) · 16 블록 × 엑셀 · 우리 두 판 겹분수 0 · 금액 · 문서 그대로
- markDiff = 클래스로만 찾음(matches 없는 가짜 DOM 시험 헬퍼)
- 시험 test_848_3_import_frac(EST main 33 · 엑셀 북부청임도 43 · 옛 코드에서 실패 확인)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 21:28:46 +09:00
co-authored by Claude Opus 5.5
parent a3282d33aa
commit 30736a9749
3 changed files with 50 additions and 3 deletions
+2 -1
View File
@@ -77,7 +77,8 @@ export const diffOf = (src: Source | undefined): UiDiff | null =>
/** 칸 묶음 안 입력 · 고르기 · 이름 단추에 「바뀜」 상태 · 풍선(원래 값) */
export function markDiff(box: HTMLElement, diff: UiDiff | null, was?: string): void {
const nodes = box.matches(".ui-input, .ui-select, .ui-btn") ? [box] : [...box.querySelectorAll<HTMLElement>(".ui-input, .ui-select, .ui-btn.lstk-res")]; // prettier-ignore
const own = ["ui-input", "ui-select", "ui-btn"].some((c) => box.classList.contains(c));
const nodes = own ? [box] : ["ui-input", "ui-select", "lstk-res"].flatMap((c) => [...box.querySelectorAll<HTMLElement>(`.${c}`)]); // prettier-ignore
for (const n of nodes) {
setUiDiff(n, diff);
if (diff && was !== undefined)
+4 -2
View File
@@ -241,9 +241,11 @@ function rows(
const v = vals[id];
const t = lines.get(id);
const head = katexNode(symTex(alias[id] ?? id));
if (t !== undefined && hasVar(t)) {
const tn = t === undefined ? null : nodeOf(t);
// 848-3 수만인 식도 두 층 넘는 분수면(가져온 공식 줄 `Q = (4.5 + 5.5) ÷ 2 ÷ 0.35` 꼴) 아래 줄 나눔 규칙으로
if (t !== undefined && (hasVar(t) || (tn && fracDepth(tn) > 1))) {
flush();
const n = nodeOf(t)!;
const n = tn!;
if (!machine && fracDepth(n) <= 1) {
push({ h: formula(id, n, v, unit(id), vals, {}) });
continue;
@@ -0,0 +1,44 @@
"""848-3(조사 889b F) — 가져온 공식 줄의 수만인 겹분수도 산출근거에서 두 층 안(줄 나눔 규칙) · 금액 · 문서 그대로.
짝 = `A00_Common/line_stack_out.ts` 공식 묶음(`block` — 수만인 식이 두 층 넘는 분수면 중간 줄 길) ·
그리기 = 진짜 화면 코드를 가짜 DOM 으로(`helper_845_2_unit_show.cjs` 「전수」 · 기계 줄 = 위 · 아래 모두 봄).
견본 = EST main 33(석축헐기 Q = (4.5 + 5.5) ÷ 2 ÷ 0.35) · 엑셀 북부청임도 43 — 엑셀 · 우리 두 판.
"""
import pytest
from M02_MasterTemplete import M02_Doc_Copy as dc
from M02_MasterTemplete import M02_Doc_FromNative as fn
from M02_MasterTemplete import M02_Doc_Import as dim
from M02_MasterTemplete import M02_San_Xlsx as sx
from M02_MasterTemplete import M02_Sangeun_Imported as imp
from resources.tester import test_797_1a_import_flags as practice
from resources.tester import test_810_1_estx as e
from resources.tester import test_810_2_native_doc as t
from resources.tester import test_846_2_work_view as w2
def _saved(kind: str, tag: str):
if kind == "엑셀":
p = practice.FILES[tag]
return fn.pack(sx.read(p.name, p.read_bytes()), p.name)
p = e.FILES[tag]
return fn.read(p.name, p.read_bytes())
@pytest.mark.parametrize("kind,tag,no", [("EST", "main", 33), ("엑셀", "북부청임도", 43)])
def test_가져온_식_겹분수_두_층_안(kind, tag, no):
p = (practice.FILES if kind == "엑셀" else e.FILES)[tag]
if not p or not p.exists():
pytest.skip("견본 파일 없음")
sk = t.sk_of(fn.emit(_saved(kind, tag), no))
doc = dim.derive(sk, None, t.whole())
cases = []
for basis in ("엑셀", "우리"):
sk2 = {**sk, imp.KEY: {**sk[imp.KEY], "단가기준": basis}}
cases.append(
{"키": basis, "문서": dim.view(doc, basis), "연결": dim.record(doc, sk2), "기계": True}
)
got = w2._js({"할일": "전수", "문서들": dc.ml._norm(cases), "보기": []})
assert [b for g in got for b in g["bad"] if b[0] == "겹분수"] == []
assert all(g["같음"] for g in got)