|
11 | 11 | */
|
12 | 12 |
|
13 | 13 | 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'; |
15 | 31 | import {CalendarDate} from '@internationalized/date';
|
16 | 32 | import React from 'react';
|
17 | 33 | import userEvent from '@testing-library/user-event';
|
@@ -293,12 +309,11 @@ describe('DateRangePicker', () => {
|
293 | 309 | await user.click(cells[10].children[0]);
|
294 | 310 | expect(dialog).not.toBeInTheDocument();
|
295 | 311 |
|
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'))); |
302 | 317 | });
|
303 | 318 |
|
304 | 319 | it('should disable button and date input when DatePicker is disabled', () => {
|
|
0 commit comments