feat(markdown): implement table rendering with imgui.begin_table
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user