Skip to content

Commit a19bf93

Browse files
committed
fix date range picker test locally
1 parent fea968c commit a19bf93

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

packages/react-aria-components/test/DateRangePicker.test.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,23 @@
1111
*/
1212

1313
import {act, pointerMap, render, within} from '@react-spectrum/test-utils-internal';
14-
import {Button, CalendarCell, CalendarGrid, DateInput, DateRangePicker, DateRangePickerContext, DateSegment, Dialog, FieldError, Group, Heading, Label, Popover, RangeCalendar, Text} from 'react-aria-components';
14+
import {
15+
Button,
16+
CalendarCell,
17+
CalendarGrid,
18+
DateInput,
19+
DateRangePicker,
20+
DateRangePickerContext,
21+
DateSegment,
22+
Dialog,
23+
FieldError,
24+
Group,
25+
Heading,
26+
Label,
27+
Popover,
28+
RangeCalendar,
29+
Text
30+
} from 'react-aria-components';
1531
import {CalendarDate} from '@internationalized/date';
1632
import React from 'react';
1733
import userEvent from '@testing-library/user-event';
@@ -293,12 +309,11 @@ describe('DateRangePicker', () => {
293309
await user.click(cells[10].children[0]);
294310
expect(dialog).not.toBeInTheDocument();
295311

296-
// let group = getByRole('group');
297-
// let inputs = group.querySelectorAll('.react-aria-DateInput');
298-
// let normalize = (s) => s.replace(/\s/g, ' ').replace(/[\u2066\u2069]/g, '');
299-
// TODO: Fix this test. It only works if you run the test in the US, HAHA
300-
// expect(normalize(inputs[0].textContent)).toBe(normalize(new Date(2023, 0, 6).toLocaleString()));
301-
// expect(normalize(inputs[1].textContent)).toBe(normalize(new Date(2023, 0, 11).toLocaleString()));
312+
let group = getByRole('group');
313+
let inputs = group.querySelectorAll('.react-aria-DateInput');
314+
let normalize = (s) => s.replace(/\s/g, ' ').replace(/[\u2066\u2069]/g, '');
315+
expect(normalize(inputs[0].textContent)).toBe(normalize(new Date(2023, 0, 6).toLocaleString('en-US')));
316+
expect(normalize(inputs[1].textContent)).toBe(normalize(new Date(2023, 0, 11).toLocaleString('en-US')));
302317
});
303318

304319
it('should disable button and date input when DatePicker is disabled', () => {

0 commit comments

Comments
 (0)