Skip to content
quarry Artifact [2d9a9bb288]
Login

Artifact [2d9a9bb288]

Artifact 2d9a9bb2888eea96739581c2c8ab01854c63980fbfe9418525904bf0e26b8940:


package web

import (
	"strings"
	"testing"

	"craftdesign.group/quarry/internal/oltp"
)

// The add-a-person field completes against the forge's accounts, and
// not only through a datalist: Safari suppresses that popup on a field
// that also says autocomplete="off", so a phone saw no completion at
// all. The list quarry renders itself is the one that shows.
func TestRosterAddFieldCompletes(t *testing.T) {
	var b strings.Builder
	if err := settingsPage.ExecuteTemplate(&b, "content", pageData{
		Repo: "alpha", IsAdmin: true, Logins: []string{"calionauta", "dmestas"},
		Roster: &rosterPanel{Presets: []oltp.Preset{{Name: "Developer"}}},
	}); err != nil {
		t.Fatal(err)
	}
	got := b.String()
	for _, want := range []string{
		`id="roster-suggest"`,
		"/r/alpha/people.frag",
		`<datalist id="logins">`,
	} {
		if !strings.Contains(got, want) {
			t.Errorf("FAIL: the add field has no completion: missing %s", want)
		}
	}
	t.Log("ok: the field completes through a list quarry renders, with the datalist as the floor")
}