Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Integrate nationale feedback komponente
Browse files Browse the repository at this point in the history
  • Loading branch information
malte-laukoetter committed Nov 22, 2023
1 parent 57941b4 commit 00ce75b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
20 changes: 20 additions & 0 deletions app/feedback/nationale-feedback-komponente.client.ts
Original file line number Diff line number Diff line change
@@ -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);
};
4 changes: 4 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default function App() {
<ScrollRestoration />
<Scripts />
<LiveReload />
<script
src="https://stage.formular.support.115.de/demofeedback/bmi-widget.js"
id="bmi115WidgetScript"
></script>
</body>
</html>
);
Expand Down
6 changes: 5 additions & 1 deletion app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { MetaFunction } from "@remix-run/node";
import { requestFeedback } from "~/feedback/nationale-feedback-komponente.client";

export const meta: MetaFunction = () => {
return [
Expand All @@ -11,7 +12,10 @@ export default function Index() {
return (
<main className={"flex flex-col items-center m-40"}>
<h1 className={"ds-heading-01-reg mb-40"}>Hello DigitalService!</h1>
<button className="ds-button ds-button-large">
<button
className="ds-button ds-button-large"
onClick={() => requestFeedback()}
>
<span className="ds-button-label">Click me for nothing</span>
</button>
</main>
Expand Down
16 changes: 15 additions & 1 deletion tests/a11y/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});
});
});
8 changes: 8 additions & 0 deletions tests/e2e/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

0 comments on commit 00ce75b

Please sign in to comment.