diff --git a/app/feedback/nationale-feedback-komponente.client.ts b/app/feedback/nationale-feedback-komponente.client.ts new file mode 100644 index 0000000..8d5d06f --- /dev/null +++ b/app/feedback/nationale-feedback-komponente.client.ts @@ -0,0 +1,20 @@ +export const requestFeedback = function () { + const fakeFeedbackWidgetTarget = document.createElement("button"); + fakeFeedbackWidgetTarget.dataset.context = JSON.stringify({ + portalId: "demofeedback", + instrumentId: "assist-service", + }); + fakeFeedbackWidgetTarget.dataset.theme = JSON.stringify({ + textColor: "#000", + textBackgroundColor: "#fff", + headlineColor: "#000", + error: "#f00", + textfieldColor: "#000", + textfieldBackgroundColor: "#fff", + footerTextColor: "#000", + footerBackgroundColor: "#fff", + buttonPrimaryColor: "#fff", + buttonPrimaryBackgroundColor: "#004b76", + }); + window.bmi115WidgetButton.init(fakeFeedbackWidgetTarget); +}; diff --git a/app/root.tsx b/app/root.tsx index 8e83f17..240c391 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -49,6 +49,10 @@ export default function App() { + ); diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 3a4d1db..e9fe32e 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,4 +1,5 @@ import type { MetaFunction } from "@remix-run/node"; +import { requestFeedback } from "~/feedback/nationale-feedback-komponente.client"; export const meta: MetaFunction = () => { return [ @@ -11,7 +12,10 @@ export default function Index() { return (

Hello DigitalService!

-
diff --git a/tests/a11y/example.spec.ts b/tests/a11y/example.spec.ts index 6c7ea44..b590954 100644 --- a/tests/a11y/example.spec.ts +++ b/tests/a11y/example.spec.ts @@ -8,7 +8,21 @@ test.describe("index", () => { await page.goto("/"); const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); - expect(accessibilityScanResults.violations).toEqual([]); }); + + test.describe("feedback", () => { + test("should not have any automatically detectable accessibility issues", async ({ + page, + }) => { + await page.goto("/"); + await page.getByRole("button", { name: "Click me for nothing" }).click(); + await expect( + page.getByRole("heading", { name: "Ihr Feedback" }), + ).toBeVisible(); + + const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); + expect(accessibilityScanResults.violations).toEqual([]); + }); + }); }); diff --git a/tests/e2e/example.spec.ts b/tests/e2e/example.spec.ts index af84f00..ad0d496 100644 --- a/tests/e2e/example.spec.ts +++ b/tests/e2e/example.spec.ts @@ -10,4 +10,12 @@ test.describe("basic example test", () => { await page.goto("/"); await expect(page.locator("text=DigitalService")).toBeVisible(); }); + + test("clicking on the button shows the feedback dialog", async ({ page }) => { + await page.goto("/"); + await page.getByRole("button", { name: "Click me for nothing" }).click(); + await expect( + page.getByRole("heading", { name: "Ihr Feedback" }), + ).toBeVisible(); + }); });