package views

import (
	"strings"
	"testing"
)

func TestChatMainContentRendersBubbleClasses(t *testing.T) {
	data := DiscussionTabData{
		Messages: []DiscussionMessageView{
			{Author: "you@xtablo.com", Timestamp: "09:14", Body: "Hello", IsOwn: true},
			{Author: "other@xtablo.com", Timestamp: "09:17", Body: "Hi there", IsOwn: false},
		},
	}

	html := renderViewToString(t, ChatMainContent(data))

	for _, want := range []string{
		`class="ui-card"`,
		`message-own`,
		`message-other`,
		`message-bubble`,
	} {
		if !strings.Contains(html, want) {
			t.Fatalf("expected %q in rendered HTML, got:\n%s", want, html)
		}
	}
}
