Private
Public Access
0
0

feat(markdown): implement table rendering with imgui.begin_table

This commit is contained in:
2026-06-03 11:08:58 -04:00
parent 4d410c8ff4
commit f72e72c92c
2 changed files with 40 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
from unittest.mock import patch
from src.markdown_table import parse_tables, render_table, TableBlock
def test_render_table_invokes_begin_table(app_instance):
with patch("src.markdown_table.imgui") as mock_imgui:
mock_imgui.TableFlags_ = type("T", (), {"borders": 1, "row_bg": 2, "resizable": 4})()
mock_imgui.begin_table.return_value = True
block = TableBlock(headers=["A", "B"], rows=[["1", "2"]], span=(0, 3))
render_table(block)
assert mock_imgui.begin_table.called
args, _ = mock_imgui.begin_table.call_args
assert args[0] == "md_table"
assert args[1] == 2
assert mock_imgui.end_table.called
def test_render_table_skips_when_no_columns():
with patch("src.markdown_table.imgui") as mock_imgui:
block = TableBlock(headers=[], rows=[], span=(0, 1))
render_table(block)
assert not mock_imgui.begin_table.called