Projects under organizations with fixed URL name and feature ID prefix, three visibility levels, open contribution, per-project roles, settings and typed-confirmation delete. Hidden projects 404. Leaving an org drops its project roles. Project access rules live in intent/access.py alongside org access. Features numbered per project (INT-12) in a tree. Every change is a revision with a required note; history, old revisions, and side-by-side field and line diffs between any two. Cycles and superseded-without-replacement are rejected. Markdown renders safely with source-line attributes for Phase 3 line comments and headings shifted below the page h1. Server-side preview works without JS. Structural accessibility check runs on every page in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
from intent.features.diff import line_diff
|
|
from intent.markdown import render
|
|
|
|
|
|
def test_blocks_carry_source_lines():
|
|
html = render("Para one\ncontinues.\n\n- a\n- b\n")
|
|
assert '<p data-source-lines="1-2">' in html
|
|
assert '<li data-source-lines="4-4">' in html
|
|
|
|
|
|
def test_headings_shift_down_one_level():
|
|
html = render("# Top\n\n###### Deepest\n")
|
|
assert "<h2" in html and "<h1" not in html
|
|
assert "<h6" in html
|
|
|
|
|
|
def test_raw_html_and_script_links_are_neutralised():
|
|
html = render("<script>alert(1)</script>\n\n[x](javascript:alert(1)) <img src=x onerror=y>")
|
|
assert "<script" not in html
|
|
assert "javascript:" not in html.replace("[x](javascript:alert(1))", "")
|
|
assert "onerror" not in html.replace("onerror=y>", "")
|
|
|
|
|
|
def test_tables_and_strikethrough():
|
|
html = render("| a |\n|---|\n| 1 |\n\n~~old~~")
|
|
assert "<table" in html and "<s>old</s>" in html
|
|
|
|
|
|
def test_line_diff_hunks():
|
|
old = "\n".join(f"line {i}" for i in range(1, 21))
|
|
new = old.replace("line 10", "line ten")
|
|
[hunk] = line_diff(old, new)
|
|
kinds = [(line.kind, line.old_number, line.new_number) for line in hunk]
|
|
assert ("removed", 10, None) in kinds
|
|
assert ("added", None, 10) in kinds
|
|
assert kinds[0] == ("same", 7, 7) # three lines of context
|
|
assert line_diff(old, old) == []
|