Iterate
@@ -155,6 +155,7 @@ const Menu: FC<Props> = ({ api, config, fallbackLogoUrl }) => {
|
|||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
let content: JSX.Element;
|
let content: JSX.Element;
|
||||||
|
let logoUrl = fallbackLogoUrl;
|
||||||
if (config instanceof Error) {
|
if (config instanceof Error) {
|
||||||
content = <CentredContainer>{api.i18n.translate("univention_error")}</CentredContainer>;
|
content = <CentredContainer>{api.i18n.translate("univention_error")}</CentredContainer>;
|
||||||
} else if (config) {
|
} else if (config) {
|
||||||
@@ -165,6 +166,9 @@ const Menu: FC<Props> = ({ api, config, fallbackLogoUrl }) => {
|
|||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
if (config.logo_url) {
|
||||||
|
logoUrl = config.logo_url;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
content = (
|
content = (
|
||||||
<CentredContainer>
|
<CentredContainer>
|
||||||
@@ -205,7 +209,7 @@ const Menu: FC<Props> = ({ api, config, fallbackLogoUrl }) => {
|
|||||||
>
|
>
|
||||||
<Dialog.Title>
|
<Dialog.Title>
|
||||||
<SidebarHeading>
|
<SidebarHeading>
|
||||||
<Logo api={api} src={config?.logo_url ?? fallbackLogoUrl} />
|
<Logo api={api} src={logoUrl} />
|
||||||
<Dialog.Close asChild>
|
<Dialog.Close asChild>
|
||||||
<CloseButton
|
<CloseButton
|
||||||
aria-label={api.i18n.translate("close_label")}
|
aria-label={api.i18n.translate("close_label")}
|
||||||
|
|||||||
@@ -5,15 +5,21 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { test, expect } from "../../../../playwright/element-web-test.ts";
|
import { test as base, expect } from "../../../../playwright/element-web-test.ts";
|
||||||
import { ModuleConfig } from "../src/config.ts";
|
import { ModuleConfig } from "../src/config.ts";
|
||||||
|
|
||||||
|
const test = base.extend<{
|
||||||
|
// Resolver for when to respond to the navigation.json request
|
||||||
|
navigationJsonResolver: PromiseWithResolvers<void>;
|
||||||
|
}>({
|
||||||
|
navigationJsonResolver: async ({}, use) => {
|
||||||
|
await use(Promise.withResolvers<void>());
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
test.describe("Banner", () => {
|
test.describe("Banner", () => {
|
||||||
test.use({
|
test.use({
|
||||||
displayName: "Timmy",
|
displayName: "Timmy",
|
||||||
navigationJsonResolver: async ({}, use) => {
|
|
||||||
await use(Promise.withResolvers<void>());
|
|
||||||
},
|
|
||||||
page: async ({ context, page, moduleDir }, use) => {
|
page: async ({ context, page, moduleDir }, use) => {
|
||||||
for (const path of ["logo.svg", "app1.png", "app2.png", "opendesk/"]) {
|
for (const path of ["logo.svg", "app1.png", "app2.png", "opendesk/"]) {
|
||||||
await context.route(`/${path}*`, async (route) => {
|
await context.route(`/${path}*`, async (route) => {
|
||||||
@@ -190,14 +196,13 @@ test.describe("Banner", () => {
|
|||||||
await expect(page.getByRole("heading", { name: "Welcome to Element!" })).toBeVisible();
|
await expect(page.getByRole("heading", { name: "Welcome to Element!" })).toBeVisible();
|
||||||
await expect(page.getByLabel("Show portal")).toHaveAttribute("href", "https://example.com/portal");
|
await expect(page.getByLabel("Show portal")).toHaveAttribute("href", "https://example.com/portal");
|
||||||
|
|
||||||
const nav = page.locator("nav");
|
|
||||||
|
|
||||||
const trigger = page.getByLabel("Show menu");
|
const trigger = page.getByLabel("Show menu");
|
||||||
|
|
||||||
await trigger.click();
|
await trigger.click();
|
||||||
const sidebar = page.getByRole("dialog");
|
const sidebar = page.getByRole("dialog");
|
||||||
await expect(sidebar.getByText("Failed to load")).toBeVisible();
|
await expect(sidebar.getByText("Failed to load")).toBeVisible();
|
||||||
await expect(sidebar).toMatchScreenshot("univention_error.png");
|
await expect(sidebar).toMatchScreenshot("univention_error.png");
|
||||||
|
await expect(axe).toHaveNoViolations();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |