package render import ( "regexp" "strings" "testing" ) // Icons reuse ids ("a", "folder"), so each symbol's ids carry its own prefix. func TestSymbolIDsArePrefixed(t *testing.T) { syms, err := loadSymbols() if err != nil { t.Fatal(err) } for id, want := range map[string]string{ "f-kotlin": `fill="url(#xf-kotlin-a)"`, "f-folder-css": `href="#xf-folder-css-a"`, } { if s := string(syms[id]); !strings.Contains(s, want) || !strings.Contains(s, `id="xf-`+id[2:]+`-a"`) { t.Errorf("%s: ids not prefixed: %.200s", id, s) } } // a root fill="none" keeps hiding the icon's background square for _, id := range []string{"f-document", "f-readme", "f-changelog", "f-log", "f-settings", "f-just"} { if !strings.HasPrefix(string(syms[id]), `