Skip to content

Commit

Permalink
added tests for BreakTimeNotificationContent
Browse files Browse the repository at this point in the history
  • Loading branch information
DerKatsche committed Oct 18, 2024
1 parent 654b273 commit eada5f2
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function BreakTimeNotificationContent({
src={breakTimeNotification.images[currentSlide]}
title="Pausenhinweis"
alt=""
data-testid="id-slide-2"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react";
import BreakTimeNotificationContent from "../../../../../Core/Presentation/React/GeneralComponents/BreakTimeNotificationOverview/BreakTimeNotificationContent";
import { act, fireEvent, render } from "@testing-library/react";
import { shortBreakTimeNotificationContents } from "../../../../../Core/Domain/BreakTimeNotifications/BreakTimeNotifications";

describe("BreakTimeNotificationContent", () => {
test("should render", () => {
const renderResult = render(
<BreakTimeNotificationContent
breakTimeNotification={shortBreakTimeNotificationContents[0]}
/>,
);

expect(renderResult.container).not.toBeEmptyDOMElement();
expect(renderResult.container).toMatchSnapshot();
});

// ANF-ID: [EKJ0003]
test("click on navigation dot changes current slide image", () => {
const renderResult = render(
<BreakTimeNotificationContent
breakTimeNotification={shortBreakTimeNotificationContents[0]}
/>,
);

act(() => {
const navigationDots = renderResult.getAllByRole("button");
fireEvent.click(navigationDots[1]);
});

expect(renderResult.getByRole("presentation").getAttribute("src")).toBe(
shortBreakTimeNotificationContents[0].images[1],
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`BreakTimeNotificationContent should render 1`] = `
<div>
<div
class="pb-4 max-h-[90vh] portrait:max-w-[90vw]"
>
<div
class="flex flex-col items-center gap-6 mx-0 my-auto slider-wrapper"
>
<div
class="flex flex-col gap-4 overflow-y-auto items-center justify-center slider portrait:max-w-[90vw] max-h-[90vh]"
>
<p
class="w-full pb-4 pl-6 text-sm font-bold md:text-xl lg:text-xl max-w-[60vw] ultraWide:max-w-[40vw] text-adlerdarkblue"
>
shortBreakBase
infoMobilization
</p>
<img
alt=""
class="object-cover max-h-[60vh] portrait:max-w-full rounded-lg"
id="slide-2"
src="smallBreakContent-B3-slide1.png"
title="Pausenhinweis"
/>
</div>
<div
class="z-10 flex gap-4 lg:gap-6 slider-nav"
>
<button
class="bg-yellow-400 w-2 h-2 transition duration-200 ease-in-out rounded-full opacity-75 lg:w-4 lg:h-4 hover:opacity-100"
data-testid="breakSliderButton0"
/>
<button
class="bg-white w-2 h-2 transition duration-200 ease-in-out rounded-full opacity-75 lg:w-4 lg:h-4 hover:opacity-100"
data-testid="breakSliderButton1"
/>
</div>
</div>
</div>
</div>
`;

0 comments on commit eada5f2

Please sign in to comment.