feat: implement layout 3-tier container architecture, desktop screen token, Gate 8 no-escape rule, and clean dead code
This commit is contained in:
@@ -158,6 +158,68 @@ def test_unittest_suite():
|
||||
print("✅ Gate 7 PASSED: All 6 DOM & static HTML content assertion tests passed")
|
||||
return True
|
||||
|
||||
def test_layout_architecture():
|
||||
print("\n--- Gate 8: Layout Architecture & No-Escape Gate (AC-25 / AC-26 / R-8.17) ---")
|
||||
|
||||
# 1) Check HTML SSG pages for container-content inside main
|
||||
routes_to_check = [
|
||||
os.path.join(".next", "server", "app", "index.html"),
|
||||
os.path.join(".next", "server", "app", "members.html"),
|
||||
os.path.join(".next", "server", "app", "publications.html"),
|
||||
os.path.join(".next", "server", "app", "lectures.html"),
|
||||
os.path.join(".next", "server", "app", "standardization.html"),
|
||||
]
|
||||
|
||||
for rel_p in routes_to_check:
|
||||
full_p = os.path.join(REFER_DIR, rel_p)
|
||||
if not os.path.exists(full_p):
|
||||
print(f"❌ Missing SSG route HTML: {rel_p}")
|
||||
return False
|
||||
with open(full_p, "r", encoding="utf-8") as f:
|
||||
html = f.read()
|
||||
|
||||
# Verify <main tag does NOT contain max-w- or px-
|
||||
main_match = re.search(r'<main\s+class="([^"]*)"', html)
|
||||
if not main_match:
|
||||
print(f"❌ <main> tag not found in {rel_p}")
|
||||
return False
|
||||
main_cls = main_match.group(1)
|
||||
if "max-w-" in main_cls or "px-" in main_cls or "container-content" in main_cls:
|
||||
print(f"❌ <main> tag in {rel_p} restricts width or padding ({main_cls}). Should be w-full flex-1 only.")
|
||||
return False
|
||||
|
||||
# Verify child wrapper has container-content
|
||||
if "container-content" not in html:
|
||||
print(f"❌ container-content missing in {rel_p}")
|
||||
return False
|
||||
|
||||
# 2) Check source for forbidden escaped arbitrary classes (AC-26)
|
||||
forbidden_terms = ["w-screen", "-mx-[50vw]", "min-[1240px]:"]
|
||||
for root, _, files in os.walk(os.path.join(REFER_DIR, "app")):
|
||||
for fname in files:
|
||||
if fname.endswith((".ts", ".tsx")):
|
||||
fpath = os.path.join(root, fname)
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
for term in forbidden_terms:
|
||||
if term in content:
|
||||
print(f"❌ Forbidden term '{term}' found in {fpath}")
|
||||
return False
|
||||
|
||||
for root, _, files in os.walk(os.path.join(REFER_DIR, "components")):
|
||||
for fname in files:
|
||||
if fname.endswith((".ts", ".tsx")):
|
||||
fpath = os.path.join(root, fname)
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
for term in forbidden_terms:
|
||||
if term in content:
|
||||
print(f"❌ Forbidden term '{term}' found in {fpath}")
|
||||
return False
|
||||
|
||||
print("✅ Gate 8 PASSED: Layout 3-tier architecture and AC-25/AC-26 no-escape rule verified")
|
||||
return True
|
||||
|
||||
def main():
|
||||
print("=" * 70)
|
||||
print(" ANL HOMEPAGE E2E TEST SUITE RUNNER — TIERS 1-4")
|
||||
@@ -172,6 +234,7 @@ def main():
|
||||
success &= test_data_counts()
|
||||
success &= test_theme_tokens()
|
||||
success &= test_unittest_suite()
|
||||
success &= test_layout_architecture()
|
||||
|
||||
print("\n" + "-" * 70)
|
||||
if success:
|
||||
|
||||
Reference in New Issue
Block a user