File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
packages/react-material-ui/__tests__ Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 44
55import '@testing-library/jest-dom' ;
66import React from 'react' ;
7- import { render , fireEvent , getByRole } from '@testing-library/react' ;
8- import {
9- LocalizationProvider ,
10- MuiPickersAdapter ,
11- MuiPickersAdapterContext ,
12- } from '@mui/x-date-pickers' ;
13- import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns' ;
7+ import { render } from '@testing-library/react' ;
148import DateRangePicker from '../src/components/DateRangePicker' ;
159
1610describe ( 'DateRangePicker Component' , ( ) => {
@@ -46,4 +40,21 @@ describe('DateRangePicker Component', () => {
4640 expect ( startDateInput ) . toBeInTheDocument ( ) ;
4741 expect ( endDateInput ) . toBeInTheDocument ( ) ;
4842 } ) ;
43+
44+ test ( 'should set input values when prop is passed' , ( ) => {
45+ const { getByTestId } = render (
46+ < DateRangePicker
47+ label = "Date Range"
48+ value = { {
49+ startDate : new Date ( '2024-12-10T18:34:37.172Z' ) ,
50+ endDate : new Date ( '2025-01-08T18:34:37.172Z' ) ,
51+ } }
52+ /> ,
53+ ) ;
54+ const startDateInput = getByTestId ( 'start-date-input' ) ;
55+ const endDateInput = getByTestId ( 'end-date-input' ) ;
56+
57+ expect ( startDateInput ) . toHaveValue ( '2024-12-10' ) ;
58+ expect ( endDateInput ) . toHaveValue ( '2025-01-08' ) ;
59+ } ) ;
4960} ) ;
You can’t perform that action at this time.
0 commit comments