diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-31 08:15:33 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-05-31 08:15:33 -0400 |
commit | c5deb333db40e4e527f98edb93b41d1b66cfec5f (patch) | |
tree | 8585da3f41551592c23e4fb54c514a4c069ee957 /model/user_test.go | |
parent | 64cce071a9ae28444e95b6389b229d80f20acf68 (diff) | |
download | chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.tar.gz chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.tar.bz2 chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.zip |
Added validation to make sure theme entries are colours (#3107)
* Added validation to make sure theme entries are colours
* Added serverside validation for theme
Diffstat (limited to 'model/user_test.go')
-rw-r--r-- | model/user_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/user_test.go b/model/user_test.go index c6f7dfecc..d8ef77d6a 100644 --- a/model/user_test.go +++ b/model/user_test.go @@ -39,6 +39,19 @@ func TestUserPreSave(t *testing.T) { func TestUserPreUpdate(t *testing.T) { user := User{Password: "test"} user.PreUpdate() + + user.ThemeProps = StringMap{ + "codeTheme": "github", + "awayIndicator": "#cdbd4e", + "buttonColor": "invalid", + } + user.PreUpdate() + + if user.ThemeProps["codeTheme"] != "github" || user.ThemeProps["awayIndicator"] != "#cdbd4e" { + t.Fatal("shouldn't have changed valid theme props") + } else if user.ThemeProps["buttonColor"] != "#ffffff" { + t.Fatal("should've changed invalid theme prop") + } } func TestUserUpdateMentionKeysFromUsername(t *testing.T) { |