package web
import (
"strings"
"testing"
)
// The composer offers the Rich tab and a pane that reads the draft's
// blocks from this repository's markup-blocks; Write stays the default.
func TestTheComposerOffersRichBlocks(t *testing.T) {
var b strings.Builder
if err := noHooks.template(forumAnnouncePage).ExecuteTemplate(&b, "content", pageData{Repo: "alpha", Composer: true}); err != nil {
t.Fatal(err)
}
s := b.String()
if !strings.Contains(s, `data-hook="composer-rich"`) || !strings.Contains(s, `data-blocks="/r/alpha/markup-blocks"`) {
t.Error("FAIL: the composer has no Rich tab reading this repository's blocks")
}
if !strings.Contains(s, `class="f-tab here" data-tab="write"`) {
t.Error("FAIL: Write is no longer the tab the composer opens on")
}
}