-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for BreakTimeNotificationContent
- Loading branch information
1 parent
654b273
commit eada5f2
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...act/GeneralComponents/BreakTimeNotificationOverview/BreakTimeNotificationContent.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], | ||
); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
...ts/BreakTimeNotificationOverview/__snapshots__/BreakTimeNotificationContent.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |