mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Fix: vela top cannot switch the theme (#5745)
Signed-off-by: howieyuen <howieyuen@outlook.com>
This commit is contained in:
@@ -291,7 +291,7 @@ func makeThemeConfigFileIfNotExist() bool {
|
||||
if _, err := os.Open(filepath.Clean(themeConfigFilePath)); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
// make file if not exist
|
||||
_ = os.MkdirAll(filepath.Clean(velaThemeHome), 0600)
|
||||
_ = os.MkdirAll(filepath.Clean(velaThemeHome), 0700)
|
||||
_ = os.WriteFile(filepath.Clean(themeConfigFilePath), []byte("name : "+DefaultTheme), 0600)
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
@@ -35,3 +37,11 @@ func TestColor(t *testing.T) {
|
||||
c2 := Color("red")
|
||||
assert.Equal(t, c2.Color(), tcell.GetColor("red").TrueColor())
|
||||
}
|
||||
|
||||
func TestPersistentThemeConfig(t *testing.T) {
|
||||
defer PersistentThemeConfig(DefaultTheme)
|
||||
PersistentThemeConfig("foo")
|
||||
bytes, err := os.ReadFile(themeConfigFilePath)
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, strings.Contains(string(bytes), "foo"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user