-
-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: gpbl <io@gpbl.dev>
- Loading branch information
Showing
108 changed files
with
4,516 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { app, renderApp } from "@/test"; | ||
|
||
import { ContainerAttributes } from "./ContainerAttributes"; | ||
|
||
beforeEach(() => { | ||
renderApp(<ContainerAttributes />); | ||
}); | ||
|
||
test('should have the "id" attribute', () => { | ||
expect(app().firstChild).toHaveAttribute("id", "testId"); | ||
}); | ||
|
||
test('should have the "title" attribute', () => { | ||
expect(app().firstChild).toHaveAttribute("title", "foo_title"); | ||
}); | ||
|
||
test('should have the "lang" attribute', () => { | ||
expect(app().firstChild).toHaveAttribute("lang", "it"); | ||
}); | ||
|
||
test("should have the data set attribute", () => { | ||
expect(app().firstChild).toHaveAttribute("data-test", "testData"); | ||
}); |
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,20 @@ | ||
import { DayPicker } from "react-day-picker"; | ||
|
||
/** | ||
* Pass selected HTML attributes and `data-` attributes to the root element. | ||
* | ||
* @exampleTitle Container Attributes | ||
*/ | ||
export function ContainerAttributes() { | ||
return ( | ||
<DayPicker | ||
id="testId" | ||
className="testClass" | ||
data-test="testData" | ||
nonce="foo_nonce" | ||
title="foo_title" | ||
lang="it" | ||
mode="multiple" | ||
/> | ||
); | ||
} |
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,21 @@ | ||
import { act, screen } from "@testing-library/react"; | ||
|
||
import { mockDate, grid, renderApp, user } from "@/test"; | ||
|
||
import { Controlled } from "./Controlled"; | ||
|
||
mockDate(new Date(2022, 5, 10)); | ||
|
||
describe('when the "Today" button is clicked', () => { | ||
const todayButton = () => screen.getByRole("button", { name: "Go to Today" }); | ||
beforeEach(async () => { | ||
renderApp(<Controlled />); | ||
await act(() => user.click(todayButton())); | ||
}); | ||
test("the button should be disabled", async () => { | ||
expect(todayButton()).toBeDisabled(); | ||
}); | ||
test("should display the current month", () => { | ||
expect(grid()).toHaveAccessibleName("June 2022"); | ||
}); | ||
}); |
Oops, something went wrong.