c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.4 KiB
Go
76 lines
2.4 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package fileicon_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/fileicon"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/git"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRenderEntryIconHTML_WithDifferentThemes(t *testing.T) {
|
|
// Test that folder icons use the folder theme
|
|
t.Run("FolderUsesBasicTheme", func(t *testing.T) {
|
|
defer test.MockVariableValue(&setting.UI.FileIconTheme, "material")()
|
|
defer test.MockVariableValue(&setting.UI.FolderIconTheme, "basic")()
|
|
|
|
folderEntry := &fileicon.EntryInfo{
|
|
BaseName: "testfolder",
|
|
EntryMode: git.EntryModeTree,
|
|
}
|
|
|
|
html := fileicon.RenderEntryIconHTML(nil, folderEntry)
|
|
// Basic theme renders octicon classes
|
|
assert.Contains(t, string(html), "octicon-file-directory-fill")
|
|
})
|
|
|
|
t.Run("FileUsesMaterialTheme", func(t *testing.T) {
|
|
defer test.MockVariableValue(&setting.UI.FileIconTheme, "material")()
|
|
defer test.MockVariableValue(&setting.UI.FolderIconTheme, "basic")()
|
|
|
|
fileEntry := &fileicon.EntryInfo{
|
|
BaseName: "test.js",
|
|
EntryMode: git.EntryModeBlob,
|
|
}
|
|
|
|
html := fileicon.RenderEntryIconHTML(nil, fileEntry)
|
|
// Material theme for files renders material icons
|
|
assert.Contains(t, string(html), "svg-mfi-")
|
|
})
|
|
|
|
t.Run("SymlinkToFolderUsesBasicTheme", func(t *testing.T) {
|
|
defer test.MockVariableValue(&setting.UI.FileIconTheme, "material")()
|
|
defer test.MockVariableValue(&setting.UI.FolderIconTheme, "basic")()
|
|
|
|
symlinkEntry := &fileicon.EntryInfo{
|
|
BaseName: "link",
|
|
EntryMode: git.EntryModeSymlink,
|
|
SymlinkToMode: git.EntryModeTree,
|
|
}
|
|
|
|
html := fileicon.RenderEntryIconHTML(nil, symlinkEntry)
|
|
// Symlinks to folders should use folder theme
|
|
assert.Contains(t, string(html), "octicon-file-directory-symlink")
|
|
})
|
|
|
|
t.Run("BothMaterialTheme", func(t *testing.T) {
|
|
defer test.MockVariableValue(&setting.UI.FileIconTheme, "material")()
|
|
defer test.MockVariableValue(&setting.UI.FolderIconTheme, "material")()
|
|
|
|
folderEntry := &fileicon.EntryInfo{
|
|
BaseName: "testfolder",
|
|
EntryMode: git.EntryModeTree,
|
|
}
|
|
|
|
html := fileicon.RenderEntryIconHTML(nil, folderEntry)
|
|
// Material theme for folders renders material folder icons
|
|
assert.Contains(t, string(html), "svg-mfi-")
|
|
})
|
|
}
|