refactor(ui): вынести панель «Диалог» (ChatPanel) из монолита окна
Спеца 12.12: интерфейс + Nil + FormatRole в internal/ui/chat_panel.go, Fyne-реализация в internal/ui/desktop/chat_panel.go (транскрипт + композитор). Окно как chat.Channel рендерит Send/Ask/историю через Append; state_panel не трогаем.
This commit is contained in:
26
internal/ui/chat_panel_test.go
Normal file
26
internal/ui/chat_panel_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package ui
|
||||
|
||||
import "testing"
|
||||
|
||||
// FormatRole — строка роли в диалоге (спец 12.12), pure-функция без Fyne.
|
||||
func TestFormatRole(t *testing.T) {
|
||||
if FormatRole("user") != "👤 " {
|
||||
t.Errorf("user: got %q, want «👤 »", FormatRole("user"))
|
||||
}
|
||||
if FormatRole("assistant") != "🤖 " {
|
||||
t.Errorf("assistant: got %q, want «🤖 »", FormatRole("assistant"))
|
||||
}
|
||||
if FormatRole("") != "🤖 " {
|
||||
t.Errorf("default: got %q, want «🤖 »", FormatRole(""))
|
||||
}
|
||||
}
|
||||
|
||||
// NilChatPanel — no-op контракт (спец 12.8): безопасно для headless/тестов.
|
||||
func TestNilChatPanelNoop(t *testing.T) {
|
||||
p := NewNilChatPanel()
|
||||
c := NewCommands(nil)
|
||||
p.SetTranscript("история")
|
||||
p.Append("строка")
|
||||
p.Clear()
|
||||
p.SetCommands(c)
|
||||
}
|
||||
Reference in New Issue
Block a user