Skip to content

Commit c98ed09

Browse files
author
Olayinka Adelakun
committed
fix issues
1 parent 3a4b6b1 commit c98ed09

10 files changed

Lines changed: 74 additions & 24 deletions

File tree

src/frontend/src/components/core/appHeaderComponent/__tests__/app-header-a11y.test.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ jest.mock("@/components/ui/button", () => ({
1818
children,
1919
"aria-label": ariaLabel,
2020
"data-testid": testId,
21-
unstyled,
21+
unstyled: _unstyled,
2222
...props
23-
}: any) => (
23+
}: React.ButtonHTMLAttributes<HTMLButtonElement> & {
24+
children?: React.ReactNode;
25+
"data-testid"?: string;
26+
unstyled?: boolean;
27+
}) => (
2428
<button aria-label={ariaLabel} data-testid={testId} {...props}>
2529
{children}
2630
</button>
@@ -33,7 +37,7 @@ jest.mock("@/components/ui/separator", () => ({
3337

3438
jest.mock("@/components/common/shadTooltipComponent", () => ({
3539
__esModule: true,
36-
default: ({ children }: any) => <>{children}</>,
40+
default: ({ children }: { children?: React.ReactNode }) => <>{children}</>,
3741
}));
3842

3943
jest.mock("@/components/common/modelProviderCountComponent", () => ({
@@ -43,7 +47,7 @@ jest.mock("@/components/common/modelProviderCountComponent", () => ({
4347

4448
jest.mock("@/alerts/alertDropDown", () => ({
4549
__esModule: true,
46-
default: ({ children }: any) => <>{children}</>,
50+
default: ({ children }: { children?: React.ReactNode }) => <>{children}</>,
4751
}));
4852

4953
jest.mock("@/assets/LangflowLogo.svg?react", () => ({

src/frontend/src/components/core/appHeaderComponent/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export default function AppHeader(): JSX.Element {
101101
)
102102
}
103103
data-testid="notification_button"
104-
aria-label={t("header.notifications")}
105104
>
106105
<div className="hit-area-hover group relative items-center rounded-md px-2 py-2 text-muted-foreground">
107106
<span className={getNotificationBadge()} />

src/frontend/src/components/core/folderSidebarComponent/components/sideBarFolderButtons/components/__tests__/upload-folder-button.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ jest.mock("@/components/common/shadTooltipComponent", () => ({
1818
}));
1919

2020
jest.mock("@/components/ui/button", () => ({
21-
Button: ({ children, "aria-label": ariaLabel, disabled, ...props }: any) => (
21+
Button: ({
22+
children,
23+
"aria-label": ariaLabel,
24+
disabled,
25+
...props
26+
}: React.ButtonHTMLAttributes<HTMLButtonElement> & { children?: React.ReactNode }) => (
2227
<button aria-label={ariaLabel} disabled={disabled} {...props}>
2328
{children}
2429
</button>

src/frontend/src/locales/de.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "Bitte überprüfen Sie Ihren API-Schlüssel und versuchen Sie es erneut",
20672067
"voiceAssistant.connected": "Verbunden",
20682068
"voiceAssistant.connectionError": "Verbindungsfehler",
2069-
"voiceAssistant.connectionFailed": "Verbindung fehlgeschlagen"
2069+
"voiceAssistant.connectionFailed": "Verbindung fehlgeschlagen",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/locales/es.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "Comprueba tu clave API e inténtalo de nuevo",
20672067
"voiceAssistant.connected": "Conectado",
20682068
"voiceAssistant.connectionError": "Error de conexión",
2069-
"voiceAssistant.connectionFailed": "La conexión ha fallado"
2069+
"voiceAssistant.connectionFailed": "La conexión ha fallado",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/locales/fr.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "Vérifiez votre clé API et réessayez",
20672067
"voiceAssistant.connected": "Connecté",
20682068
"voiceAssistant.connectionError": "Erreur de connexion",
2069-
"voiceAssistant.connectionFailed": "Echec de la connexion"
2069+
"voiceAssistant.connectionFailed": "Echec de la connexion",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/locales/ja.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "APIキーを確認の上、もう一度お試しください",
20672067
"voiceAssistant.connected": "接続済み",
20682068
"voiceAssistant.connectionError": "接続エラー",
2069-
"voiceAssistant.connectionFailed": "接続失敗"
2069+
"voiceAssistant.connectionFailed": "接続失敗",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/locales/pt.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "Verifique sua chave de API e tente novamente",
20672067
"voiceAssistant.connected": "Conectado",
20682068
"voiceAssistant.connectionError": "Erro de conexão",
2069-
"voiceAssistant.connectionFailed": "Conexão com falha"
2069+
"voiceAssistant.connectionFailed": "Conexão com falha",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/locales/zh-Hans.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,5 +2066,13 @@
20662066
"voiceAssistant.apiKeyError": "请检查您的 API 密钥,然后重试",
20672067
"voiceAssistant.connected": "已连接",
20682068
"voiceAssistant.connectionError": "连接错误",
2069-
"voiceAssistant.connectionFailed": "连接失败"
2069+
"voiceAssistant.connectionFailed": "连接失败",
2070+
"header.home": "Go to home",
2071+
"flows.viewList": "List view",
2072+
"flows.viewGrid": "Grid view",
2073+
"flows.downloadSelected": "Download selected flows",
2074+
"flows.selectFlow": "Select {{name}}",
2075+
"flows.moreOptions": "More options for {{name}}",
2076+
"folder.optionsFor": "Options for {{name}}",
2077+
"paginator.pageLabel": "Page"
20702078
}

src/frontend/src/pages/MainPage/components/header/__tests__/header.test.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,11 @@ describe("HeaderComponent - TabIndex Behavior with Bulk Actions", () => {
235235

236236
it("view toggle buttons have aria-label attributes", () => {
237237
const { container } = render(<HeaderComponent {...defaultProps} />);
238-
// Both view toggle buttons must carry an aria-label (actual text depends on loaded locale)
239-
const labelled = container.querySelectorAll("button[aria-label]");
240-
const viewBtns = Array.from(labelled).filter((b) => {
241-
const label = b.getAttribute("aria-label") ?? "";
242-
return (
243-
label.toLowerCase().includes("view") ||
244-
label.toLowerCase().includes("list") ||
245-
label.toLowerCase().includes("grid")
246-
);
238+
const viewBtns = container.querySelectorAll("button[aria-pressed]");
239+
expect(viewBtns.length).toBe(2);
240+
viewBtns.forEach((btn) => {
241+
expect(btn.getAttribute("aria-label")).toBeTruthy();
247242
});
248-
expect(viewBtns.length).toBeGreaterThanOrEqual(2);
249243
});
250244

251245
it("view toggle buttons expose aria-pressed reflecting active view", () => {
@@ -274,8 +268,8 @@ describe("HeaderComponent - TabIndex Behavior with Bulk Actions", () => {
274268
const falseCount = Array.from(allPressed).filter(
275269
(b) => b.getAttribute("aria-pressed") === "false",
276270
).length;
277-
expect(trueCount).toBeGreaterThanOrEqual(1);
278-
expect(falseCount).toBeGreaterThanOrEqual(1);
271+
expect(trueCount).toBe(1);
272+
expect(falseCount).toBe(1);
279273
});
280274
});
281275

0 commit comments

Comments
 (0)