package credits
import (
"bytes"
"html/template"
"strings"
"testing"
)
func TestNoticesAreEscapedAndNeedNoScript(t *testing.T) {
tpl, err := template.ParseFS(Templates(), "templates/*.html")
if err != nil {
t.Fatal(err)
}
notice := "Copyright \nPermission & conditions"
data := PageData{Title: "Open source", Components: []Component{{Name: "
", Version: "v1.2.3", SourceURL: "https://example.org/source", Notices: []Notice{{Name: "LICENSE", Text: notice}}}}}
var out bytes.Buffer
if err := tpl.ExecuteTemplate(&out, "estilo/credits", data); err != nil {
t.Fatal(err)
}
html := out.String()
if strings.Contains(html, "