Skip to content
quarry Artifact [d374689ebe]
Login

Artifact [d374689ebe]

Artifact d374689ebe78bbe61bbc4f1ffad6d938cb09f21b89fe4658f18b7094c193db2f:


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")
	}
}