Files
Jonathan Miller 9a5720e8ad
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Branch Policy Check / Verify merge target (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 3s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
chore: rename Go module from git. to code.mokoconsulting.tech (#336)
Full namespace migration: update the Go module path and all import
statements from git.mokoconsulting.tech to code.mokoconsulting.tech.
Also updates all URL references in templates, workflows, configs,
tests, and documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-31 10:28:25 -05:00

76 lines
2.4 KiB
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package fileicon_test
import (
"testing"
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/fileicon"
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/git"
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
"code.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-")
})
}