feat(context): Implement view mode UI in context composition panel
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import pytest
|
||||
from src.gui_2 import App
|
||||
from src.models import FileItem
|
||||
|
||||
def test_view_mode_initialization():
|
||||
app = App()
|
||||
# Mock imgui
|
||||
from imgui_bundle import imgui
|
||||
|
||||
app.context_files = [
|
||||
FileItem(path="test1.py"),
|
||||
FileItem(path="test2.py", view_mode="full")
|
||||
]
|
||||
|
||||
# We test the model defaults and the rendering assignment logic indirectly.
|
||||
assert app.context_files[0].view_mode == "full" # Default from FileItem Model
|
||||
assert app.context_files[1].view_mode == "full"
|
||||
|
||||
def test_batch_view_mode_change():
|
||||
app = App()
|
||||
|
||||
f1 = FileItem(path="test1.py", view_mode="full")
|
||||
f2 = FileItem(path="test2.py", view_mode="full")
|
||||
|
||||
app.context_files = [f1, f2]
|
||||
app.ui_selected_context_files = {"test1.py"}
|
||||
|
||||
# Simulate clicking "Skeleton" batch button
|
||||
for f in app.context_files:
|
||||
f_path = f.path if hasattr(f, "path") else str(f)
|
||||
if f_path in app.ui_selected_context_files:
|
||||
f.view_mode = "skeleton"
|
||||
|
||||
assert f1.view_mode == "skeleton"
|
||||
assert f2.view_mode == "full" # not selected
|
||||
Reference in New Issue
Block a user