Merge remote-tracking branch 'origin/sub_laptop_3' into sub_laptop_1
This commit is contained in:
@@ -124,7 +124,7 @@ def test_제목_합_빈_줄과_원가계산서_이음():
|
||||
assert keys[:3] == ["sec:1", "sec:1.1", "sec:1.2"] and keys[-1] == "sec:G"
|
||||
assert rows["sec:1.1"]["sum"] == 361494 + 1119272 and rows["sec:1.1"]["blank"] == 0
|
||||
assert rows["sec:1"]["sum"] == 361494 + 1119272 + 11003825 # 빈 줄은 0 이 아니라 빈 줄 수
|
||||
assert rows["sec:1"]["blank"] == 1 and "빈 줄 1" in rows["sec:1"]["note"]
|
||||
assert rows["sec:1"]["blank"] == 1 and "빈 줄" not in rows["sec:1"]["note"] # 257-2 비고 빈 줄 없음
|
||||
# 145-4 이음 = {material, labor, expense, supply_net} · 빈 줄 있으면 None
|
||||
assert sheets["bill"]["sums"] == {
|
||||
"material": None,
|
||||
|
||||
@@ -191,7 +191,7 @@ t = buildTotal(ctx());
|
||||
t.onEdit(at(t.rows, "care"), "rate", "");
|
||||
out.careGone = "care" in user.estimate.rates;
|
||||
t = buildTotal(ctx());
|
||||
out.grandBlank = t.rows[at(t.rows, "grand")].amount;
|
||||
out.grandBlank = t.total.amount; // 257-2 총공사비 = 표 아래 고정 줄
|
||||
t.onEdit(at(t.rows, "safety"), "hand", "1,000");
|
||||
out.base = user.estimate.safety_base;
|
||||
const c = buildCost(ctx());
|
||||
|
||||
@@ -121,7 +121,7 @@ def test_묶음_금액_자손_합_공종_합_그대로():
|
||||
rows = _rows(sheets)
|
||||
g2, g1 = rows["hand:g2"], rows["hand:g1"]
|
||||
assert (g2["sum"], g2["labor"], g2["material"], g2["expense"]) == (2460, 2000, 400, 60)
|
||||
assert (g2["blank"], g2["note"]) == (1, "빈 줄 1")
|
||||
assert (g2["blank"], g2["note"]) == (1, "") # 257-2 비고 빈 줄 없음
|
||||
assert (g1["sum"], g1["labor"], g1["blank"]) == (12300 + 2460, 12000, 1) # a + b(+ c 빈 줄)
|
||||
assert rows["hand:p"]["sum"] == 0 and rows["hand:p"]["note"] == ""
|
||||
# 공종 합 · 원가계산서 sums · 계 = 묶음 없을 때와 같음(묶음 줄 안 셈)
|
||||
|
||||
@@ -21,7 +21,8 @@ BODY = f"""
|
||||
const user = {{ estimate: {{}} }};
|
||||
const ctx = {{ sheets: {{ total: computeTotal({json.dumps(SUMS)}, user.estimate) }}, payload: {{}}, user, setUser: () => {{}} }};
|
||||
const pack = (t) => t.rows.map((r, i) => [r.key, r.level, t.rowClass(i), t.level.key, t.level.of(i), t.cellClass ?? null]);
|
||||
console.log(JSON.stringify({{ total: pack(buildTotal(ctx)), cost: pack(buildCost(ctx)) }}));
|
||||
const T = buildTotal(ctx), C = buildCost(ctx);
|
||||
console.log(JSON.stringify({{ total: pack(T), cost: pack(C), fixed: {{ total: T.total, cost: C.total }} }}));
|
||||
"""
|
||||
|
||||
|
||||
@@ -41,8 +42,9 @@ def _run() -> dict:
|
||||
|
||||
def test_총괄_레벨():
|
||||
rows = {k: (lv, cls) for k, lv, cls, *_ in _run()["total"]}
|
||||
top = ["direct", "net_cost", "da", "supply_price", "contract", "grand"]
|
||||
top = ["direct", "net_cost", "da", "supply_price", "contract"]
|
||||
assert all(rows[k] == (1, "is-title") for k in top)
|
||||
assert "grand" not in rows # 257-2 총공사비 = 표 아래 고정 줄(total)
|
||||
for k in ["in_price", "in_env", "indirect_labor", "machine", "retirement", "overhead", "vat",
|
||||
"supply"]: # fmt: skip
|
||||
assert rows[k] == (2, None), k
|
||||
@@ -51,8 +53,9 @@ def test_총괄_레벨():
|
||||
|
||||
def test_원가계산서_레벨():
|
||||
rows = {k: (lv, cls) for k, lv, cls, *_ in _run()["cost"]}
|
||||
for k in ["overhead", "profit", "supply_price", "vat", "contract", "supply", "grand"]:
|
||||
for k in ["overhead", "profit", "supply_price", "vat", "contract", "supply"]:
|
||||
assert rows[k] == (1, "is-title"), k
|
||||
assert "grand" not in rows # 257-2 총공사비 = 표 아래 고정 줄(total)
|
||||
for k in ["material", "labor", "expense_sum"]:
|
||||
assert rows[k] == (2, None), k
|
||||
for k in ["direct_material", "scrap", "direct_labor", "indirect_labor", "expense", "safety"]:
|
||||
@@ -74,3 +77,10 @@ def test_CSS_옛_레벨_규칙_없음_공용_표로():
|
||||
r"td\.ui-data-table__lv \{\s*padding-left: calc\(var\(--spacing-8\) \+ var\(--dt-lv, 0\) \* var\(--dt-indent\)\);",
|
||||
common,
|
||||
)
|
||||
|
||||
|
||||
def test_총공사비_아래_고정_줄_총괄_원가계산서():
|
||||
fixed = _run()["fixed"]
|
||||
assert fixed["total"]["key"] == "grand" and fixed["total"]["name"] == "총공사비"
|
||||
assert fixed["cost"]["key"] == "grand" and fixed["cost"]["group"] == "총공사비"
|
||||
assert fixed["cost"]["amount"] == fixed["total"]["amount"] # 원가계산서 = 총괄 거울
|
||||
|
||||
@@ -122,7 +122,7 @@ def test_Shell_배선_공용_표_스크롤만():
|
||||
shell = (B09 / "B09_Estimation_UI_Shell.ts").read_text("utf-8")
|
||||
assert "if (bill) jumpTo(bill.rows, at);" in shell
|
||||
assert "pickedClass(bill.rows[i]) ?? pickClass(jumpRange(), i)" in shell
|
||||
assert "table.focusRow(at, !bill)" in shell
|
||||
assert "table.focusRow(at, false)" in shell # 257-2 모든 탭 빨강 = 스크롤만
|
||||
common = (ROOT / "ui_template" / "ui_template_data_table.ts").read_text("utf-8")
|
||||
assert "focusRow: (index: number, mark?: boolean) => void;" in common
|
||||
assert "state.focus = mark ? index : null;" in common
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
"""257-2 B09 이동해 온 줄 = 모든 탭 빨강 상자 · 비고 「빈 줄 N」 없음 · 총공사비 = 표 아래 고정 줄.
|
||||
|
||||
- 쉘 = 설계내역서 밖 · 묶음 아닌 탭에도 줄 범위 [at, at] 빨강(pickClass) · 줄 누름 · Esc · 방향키로 풂(unpickOnRelease)
|
||||
- 비고 = 제목 줄 「(제외금액)」만 · 묶음 줄 빈칸(Py · TS 짝 · blank 수는 줄 값 그대로)
|
||||
- 총괄 · 원가계산서 총공사비(grand) = `TabTable.total`(몸 줄에서 빠짐 · 줄 이동 누름 없음 — 185-1 시험이 값 확인)
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from resources.tester.helper_b09_group_cards import COMMON, GROUPS, RAW, TABS, run # noqa: E402
|
||||
|
||||
B09 = ROOT / "B09_Estimation"
|
||||
|
||||
|
||||
def test_쉘_모든_탭_빨강_배선():
|
||||
shell = (B09 / "B09_Estimation_UI_Shell.ts").read_text("utf-8")
|
||||
assert "!bill && at >= 0 ? [at, at] : null" in shell
|
||||
assert "pickClass(range, i)" in shell and "unpickOnRelease(table.root)" in shell
|
||||
assert "table.focusRow(at, false)" in shell
|
||||
|
||||
|
||||
def test_풂_줄_누름_Esc_빨강만_지움():
|
||||
out = run(
|
||||
[COMMON, TABS, GROUPS],
|
||||
"""
|
||||
const root = document.createElement("div");
|
||||
const rows = [0, 1, 2].map((i) => {
|
||||
const tr = document.createElement("tr");
|
||||
tr.dataset.i = String(i);
|
||||
if (i === 1) tr.classList.add("is-pick", "is-pick-top", "is-pick-end");
|
||||
root.append(tr);
|
||||
return tr;
|
||||
});
|
||||
unpickOnRelease(root);
|
||||
const before = rows.map((t) => t.className);
|
||||
key("Escape");
|
||||
const afterEsc = rows.map((t) => t.className);
|
||||
rows[1].classList.add("is-pick");
|
||||
root.click();
|
||||
const afterClick = rows.map((t) => t.className);
|
||||
console.log(JSON.stringify({ before, afterEsc, afterClick }));
|
||||
""",
|
||||
RAW
|
||||
+ """
|
||||
E.prototype.querySelectorAll = function () { return this.all("TR").filter((t) => t.cls.has("is-pick")); };
|
||||
""",
|
||||
)
|
||||
assert out["before"] == ["", "is-pick is-pick-top is-pick-end", ""]
|
||||
assert out["afterEsc"] == ["", "", ""]
|
||||
assert out["afterClick"] == ["", "", ""]
|
||||
|
||||
|
||||
def test_비고_빈_줄_없음_Py_TS_짝():
|
||||
py = (B09 / "B09_Estimation_Calc_Bill.py").read_text("utf-8")
|
||||
ts = (B09 / "B09_Estimation_Calc_Bill.ts").read_text("utf-8")
|
||||
assert "빈 줄 {" not in py and not re.search(r"빈 줄 \$\{", ts)
|
||||
assert 'row["note"] = "(제외금액)" if row["key"] == "sec:G" else ""' in py
|
||||
assert 'row.note = row.key === "sec:G" ? "(제외금액)" : ""' in ts
|
||||
Reference in New Issue
Block a user