@@ -20,7 +20,7 @@ import PropTypes from 'prop-types';
20
20
21
21
import { render , screen } from '@testing-library/react' ;
22
22
import userEvent from '@testing-library/user-event' ;
23
- import { addMonths , isWeekend } from 'date-fns' ;
23
+ import { addMonths , isWeekend , format } from 'date-fns' ;
24
24
25
25
import {
26
26
colorMonteverde ,
@@ -32,12 +32,15 @@ import { formatDateFull } from '../test-utils';
32
32
import BpkCalendarDate from './BpkCalendarDate' ;
33
33
import BpkCalendarGrid from './BpkCalendarGrid' ;
34
34
35
+ const formatMonth = ( date : Date ) => format ( date , 'MMMM yyyy' ) ;
36
+
35
37
describe ( 'BpkCalendarGrid' , ( ) => {
36
38
it ( 'should render correctly with a different "weekStartsOn" attribute' , ( ) => {
37
39
const { asFragment } = render (
38
40
< BpkCalendarGrid
39
41
month = { new Date ( '2016-10' ) }
40
42
formatDateFull = { formatDateFull }
43
+ formatMonth = { formatMonth }
41
44
DateComponent = { BpkCalendarDate }
42
45
weekStartsOn = { 3 }
43
46
minDate = { new Date ( '2016-01' ) }
@@ -55,6 +58,7 @@ describe('BpkCalendarGrid', () => {
55
58
< BpkCalendarGrid
56
59
month = { new Date ( '2016-10' ) }
57
60
formatDateFull = { formatDateFull }
61
+ formatMonth = { formatMonth }
58
62
DateComponent = { BpkCalendarDate }
59
63
weekStartsOn = { 1 }
60
64
dateModifiers = { modifiers }
@@ -68,7 +72,7 @@ describe('BpkCalendarGrid', () => {
68
72
it ( 'should render correctly with a custom date component' , ( ) => {
69
73
const MyCustomDate = ( props : any ) => {
70
74
const cx = {
71
- backgroundColor : ( colorPanjin as string ) ,
75
+ backgroundColor : colorPanjin as string ,
72
76
width : '50%' ,
73
77
height : '50%' ,
74
78
borderRadius : '5rem' ,
@@ -86,6 +90,7 @@ describe('BpkCalendarGrid', () => {
86
90
< BpkCalendarGrid
87
91
month = { new Date ( '2016-10' ) }
88
92
formatDateFull = { formatDateFull }
93
+ formatMonth = { formatMonth }
89
94
DateComponent = { MyCustomDate }
90
95
weekStartsOn = { 1 }
91
96
minDate = { new Date ( '2016-01' ) }
@@ -102,6 +107,7 @@ describe('BpkCalendarGrid', () => {
102
107
< BpkCalendarGrid
103
108
month = { new Date ( '2016-10' ) }
104
109
formatDateFull = { formatDateFull }
110
+ formatMonth = { formatMonth }
105
111
DateComponent = { BpkCalendarDate }
106
112
weekStartsOn = { 0 }
107
113
onDateClick = { onDateClick }
@@ -125,6 +131,7 @@ describe('BpkCalendarGrid', () => {
125
131
< BpkCalendarGrid
126
132
month = { new Date ( '2016-10' ) }
127
133
formatDateFull = { formatDateFull }
134
+ formatMonth = { formatMonth }
128
135
DateComponent = { BpkCalendarDate }
129
136
weekStartsOn = { 0 }
130
137
minDate = { new Date ( '2016-01' ) }
0 commit comments