mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-26 14:01:16 -07:00
Feature: feeds widget (#7170)
Docker CI / Docker Build & Push (push) Canceled after 0s
Lint / Linting Checks (push) Canceled after 0s
Release Drafter / Update Release Draft (push) Canceled after 0s
Release Drafter / Auto Label PR (push) Canceled after 0s
Tests / vitest (1) (push) Canceled after 0s
Tests / vitest (2) (push) Canceled after 0s
Tests / vitest (3) (push) Canceled after 0s
Tests / vitest (4) (push) Canceled after 0s
Docker CI / Docker Build & Push (push) Canceled after 0s
Lint / Linting Checks (push) Canceled after 0s
Release Drafter / Update Release Draft (push) Canceled after 0s
Release Drafter / Auto Label PR (push) Canceled after 0s
Tests / vitest (1) (push) Canceled after 0s
Tests / vitest (2) (push) Canceled after 0s
Tests / vitest (3) (push) Canceled after 0s
Tests / vitest (4) (push) Canceled after 0s
This commit is contained in:
@@ -353,6 +353,9 @@ export function cleanServiceGroups(groups) {
|
||||
expandOneStreamToTwoRows,
|
||||
showEpisodeNumber,
|
||||
|
||||
// feed
|
||||
layout,
|
||||
|
||||
// frigate
|
||||
enableRecentEvents,
|
||||
|
||||
@@ -675,6 +678,9 @@ export function cleanServiceGroups(groups) {
|
||||
if (showTime) widget.showTime = showTime;
|
||||
if (timezone) widget.timezone = timezone;
|
||||
}
|
||||
if (type === "feed") {
|
||||
if (layout) widget.layout = layout;
|
||||
}
|
||||
if (type === "dockhand") {
|
||||
if (environment) widget.environment = environment;
|
||||
}
|
||||
|
||||
@@ -524,6 +524,38 @@ describe("utils/config/service-helpers", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("cleanServiceGroups keeps feed layout and drops server-side options", async () => {
|
||||
const mod = await import("./service-helpers");
|
||||
const { cleanServiceGroups } = mod;
|
||||
|
||||
const rawGroups = [
|
||||
{
|
||||
name: "Core",
|
||||
services: [
|
||||
{
|
||||
name: "News",
|
||||
widgets: [
|
||||
{
|
||||
type: "feed",
|
||||
url: "https://example.com/feed.xml?token=secret",
|
||||
maxItems: 3,
|
||||
images: false,
|
||||
layout: "grid",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
groups: [],
|
||||
},
|
||||
];
|
||||
|
||||
const feedWidget = cleanServiceGroups(rawGroups)[0].services[0].widgets[0];
|
||||
expect(feedWidget).toEqual(expect.objectContaining({ type: "feed", layout: "grid" }));
|
||||
expect(feedWidget).not.toHaveProperty("url");
|
||||
expect(feedWidget).not.toHaveProperty("maxItems");
|
||||
expect(feedWidget).not.toHaveProperty("images");
|
||||
});
|
||||
|
||||
it("findGroupByName deep-searches and annotates parent", async () => {
|
||||
const mod = await import("./service-helpers");
|
||||
const { findGroupByName } = mod;
|
||||
|
||||
Reference in New Issue
Block a user