@@ -123,16 +123,32 @@ describe('packages/date-picker/date-picker-menu', () => {
123123 expect ( grid ) . toHaveAttribute ( 'aria-label' , 'September 2023' ) ;
124124 } ) ;
125125 test ( 'chevrons have aria labels' , ( ) => {
126- const { getByLabelText } = renderDatePickerMenu ( ) ;
127- const leftChevron = getByLabelText ( 'Previous month ') ;
128- const rightChevron = getByLabelText ( 'Next month ') ;
126+ const { getByTestId } = renderDatePickerMenu ( ) ;
127+ const leftChevron = getByTestId ( 'lg-date_picker-menu-prev_month_button ') ;
128+ const rightChevron = getByTestId ( 'lg-date_picker-menu-next_month_button ') ;
129129 expect ( leftChevron ) . toBeInTheDocument ( ) ;
130130 expect ( rightChevron ) . toBeInTheDocument ( ) ;
131+ expect ( leftChevron ) . toHaveAttribute (
132+ 'aria-label' ,
133+ expect . stringContaining ( 'Previous month' ) ,
134+ ) ;
135+ expect ( rightChevron ) . toHaveAttribute (
136+ 'aria-label' ,
137+ expect . stringContaining ( 'Next month' ) ,
138+ ) ;
131139 } ) ;
132140 test ( 'select menu triggers have aria labels' , ( ) => {
133141 const { monthSelect, yearSelect } = renderDatePickerMenu ( ) ;
134142 expect ( monthSelect ) . toBeInTheDocument ( ) ;
135143 expect ( yearSelect ) . toBeInTheDocument ( ) ;
144+ expect ( monthSelect ) . toHaveAttribute (
145+ 'aria-label' ,
146+ expect . stringContaining ( 'Select month' ) ,
147+ ) ;
148+ expect ( yearSelect ) . toHaveAttribute (
149+ 'aria-label' ,
150+ expect . stringContaining ( 'Select year' ) ,
151+ ) ;
136152 } ) ;
137153 test ( 'select menus have correct values' , ( ) => {
138154 const { monthSelect, yearSelect } = renderDatePickerMenu ( ) ;
0 commit comments