1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

Fix some UI bugs and clean up unused tests (#34088)

1. Make the material icon falls back to basic theme correctly
2. Remove `TestAttributeReader`, the problem has been resolved.
3. Fix `toggleElem` bug and add tests
This commit is contained in:
wxiaoguang
2025-04-01 15:02:30 +08:00
committed by GitHub
parent d54418a7d3
commit 86c1a33369
4 changed files with 23 additions and 69 deletions

View File

@@ -99,12 +99,9 @@ func (m *MaterialIconProvider) FileIcon(ctx reqctx.RequestContext, entry *git.Tr
}
name := m.findIconNameByGit(entry)
if name == "folder" {
// the material icon pack's "folder" icon doesn't look good, so use our built-in one
// keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
return svg.RenderHTML("material-folder-generic", 16, "octicon-file-directory-fill")
}
if iconSVG, ok := m.svgs[name]; ok && iconSVG != "" {
// the material icon pack's "folder" icon doesn't look good, so use our built-in one
// keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
if iconSVG, ok := m.svgs[name]; ok && name != "folder" && iconSVG != "" {
// keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
extraClass := "octicon-file"
switch {
@@ -115,7 +112,8 @@ func (m *MaterialIconProvider) FileIcon(ctx reqctx.RequestContext, entry *git.Tr
}
return m.renderFileIconSVG(ctx, name, iconSVG, extraClass)
}
return svg.RenderHTML("octicon-file")
// TODO: use an interface or wrapper for git.Entry to make the code testable.
return BasicThemeIcon(entry)
}
func (m *MaterialIconProvider) findIconNameWithLangID(s string) string {