-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f169f4
commit 1ac187c
Showing
7 changed files
with
81 additions
and
21 deletions.
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
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
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
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
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
38 changes: 36 additions & 2 deletions
38
frontend-app/src/components/ui/DateSelector/component.test.js
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
import { fireEvent, act, render, renderHook, screen } from '@testing-library/react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import DateSelector from '.'; | ||
|
||
test("date selector test", () => {}); | ||
test("date selector test", () => { | ||
const containerClass = ".iss__dateSelector__options"; | ||
const parentClass = ".iss__dateSelector__selected"; | ||
|
||
const toggler = () => { | ||
var opened = false; | ||
return (set) => { | ||
if (set) return opened = !opened; | ||
var className = containerClass.slice(1); | ||
fireEvent.click(container.querySelector(parentClass)); | ||
opened = !opened; | ||
if (opened) className += " options--open"; | ||
expect(container.querySelector(containerClass).className).toBe(className); | ||
return opened; | ||
}; | ||
}; | ||
|
||
const { container } = render( | ||
<DateSelector onChange={(e) => e} defaultSelected={{}} /> | ||
); | ||
|
||
var toggle = toggler(); | ||
|
||
screen.getByText("clear dates"); | ||
expect(toggle()).toBeTruthy(); | ||
expect(toggle()).toBeFalsy(); | ||
expect(toggle()).toBeTruthy(); | ||
expect(container.querySelector(".off--title")).not.toBeNull(); | ||
|
||
fireEvent.click(screen.getByRole("button")); | ||
toggle(true); | ||
|
||
expect(container.querySelector(containerClass).className).toBe(containerClass.slice(1)); | ||
}); |
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