Load the Nextcloud theme in App navigation and name its core icons.
The shell paints the instance wallpaper by default, and ExApps pick menu icons from NextcloudIcons instead of raw paths. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -146,6 +146,53 @@ func TestAppNavigationChildExpandsParents(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppNavigationLoadsNextcloudTheme(t *testing.T) {
|
||||
body := navBody(t, "/")
|
||||
for _, need := range []string{
|
||||
"/apps/theming/css/default.css",
|
||||
"/index.php/apps/theming/theme/default.css",
|
||||
"/index.php/apps/theming/theme/dark.css",
|
||||
} {
|
||||
if !strings.Contains(body, need) {
|
||||
t.Fatalf("missing %s in %s", need, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppNavigationThemeCanBeDisabled(t *testing.T) {
|
||||
nav := sampleNavigation()
|
||||
nav.DisableTheme = true
|
||||
rec := httptest.NewRecorder()
|
||||
nav.Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/", nil))
|
||||
if strings.Contains(rec.Body.String(), "/apps/theming/css/default.css") {
|
||||
t.Fatalf("theme stylesheet still present: %s", rec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppNavigationFoldControlFollowsLabel(t *testing.T) {
|
||||
body := navBody(t, "/?item=domains")
|
||||
name := strings.Index(body, ">Domains<")
|
||||
fold := strings.Index(body, `aria-label="Fold Domains"`)
|
||||
if name < 0 || fold < 0 || fold < name {
|
||||
t.Fatalf("name %d fold %d", name, fold)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppNavigationRendersIconBeforeLabel(t *testing.T) {
|
||||
nav := sampleNavigation()
|
||||
nav.Items = func(*http.Request) []gonexapp.Item {
|
||||
return []gonexapp.Item{{ID: "domains", Label: "Domains", Icon: gonexapp.NextcloudIcons.Folder}}
|
||||
}
|
||||
rec := httptest.NewRecorder()
|
||||
nav.Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/?item=domains", nil))
|
||||
body := rec.Body.String()
|
||||
icon := strings.Index(body, `src="/core/img/filetypes/folder.svg"`)
|
||||
name := strings.Index(body, ">Domains<")
|
||||
if icon < 0 || name < 0 || icon > name {
|
||||
t.Fatalf("icon %d name %d", icon, name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppNavigationHeaderPrecedesTree(t *testing.T) {
|
||||
body := navBody(t, "/?item=domains")
|
||||
header := strings.Index(body, "folder-line")
|
||||
|
||||
Reference in New Issue
Block a user