1 | import { es } from "date-fns/locale/es";
|
2 |
|
3 | import type { Modifiers } from "../types";
|
4 |
|
5 | import { labelDayButton } from "./labelDayButton";
|
6 |
|
7 | const day = new Date(2022, 10, 21);
|
8 | const dayModifiers: Modifiers = {
|
9 | disabled: false,
|
10 | focusable: false,
|
11 | focused: false,
|
12 | hidden: false,
|
13 | outside: false,
|
14 | range_end: false,
|
15 | range_middle: false,
|
16 | range_start: false,
|
17 | selected: false,
|
18 | today: false
|
19 | };
|
20 |
|
21 | describe("when the day is selected", () => {
|
22 | test("return the label", () => {
|
23 | expect(labelDayButton(day, { ...dayModifiers, selected: true })).toEqual(
|
24 | "Monday, November 21st, 2022, selected"
|
25 | );
|
26 | });
|
27 | });
|
28 |
|
29 | describe("when the day is today", () => {
|
30 | test("return the label", () => {
|
31 | expect(labelDayButton(day, { ...dayModifiers, today: true })).toEqual(
|
32 | "Today, Monday, November 21st, 2022"
|
33 | );
|
34 | });
|
35 | });
|
36 |
|
37 | test("should return the localized label", () => {
|
38 | expect(labelDayButton(day, dayModifiers, { locale: es })).toEqual(
|
39 | "lunes, 21 de noviembre de 2022"
|
40 | );
|
41 | });
|