|
1 | 1 | import * as React from 'react';
|
2 | 2 | import { expect } from 'chai';
|
3 | 3 | import { spy } from 'sinon';
|
4 |
| -import { fireEvent, fireTouchChangedEvent, screen } from '@mui/internal-test-utils'; |
| 4 | +import { fireEvent, screen } from '@mui/internal-test-utils'; |
5 | 5 | import { MobileDateTimePicker } from '@mui/x-date-pickers/MobileDateTimePicker';
|
6 |
| -import { |
7 |
| - adapterToUse, |
8 |
| - createPickerRenderer, |
9 |
| - openPicker, |
10 |
| - getClockTouchEvent, |
11 |
| -} from 'test/utils/pickers'; |
| 6 | +import { adapterToUse, createPickerRenderer, openPicker } from 'test/utils/pickers'; |
12 | 7 | import { hasTouchSupport, testSkipIf } from 'test/utils/skipIf';
|
13 | 8 |
|
14 | 9 | describe('<MobileDateTimePicker />', () => {
|
@@ -119,18 +114,14 @@ describe('<MobileDateTimePicker />', () => {
|
119 | 114 | expect(onChange.lastCall.args[0]).toEqualDateTime(new Date(2010, 0, 15));
|
120 | 115 |
|
121 | 116 | // Change the hours
|
122 |
| - const hourClockEvent = getClockTouchEvent(11, '12hours'); |
123 |
| - fireTouchChangedEvent(screen.getByTestId('clock'), 'touchmove', hourClockEvent); |
124 |
| - fireTouchChangedEvent(screen.getByTestId('clock'), 'touchend', hourClockEvent); |
| 117 | + fireEvent.click(screen.getByRole('option', { name: '11 hours' })); |
125 | 118 | expect(onChange.callCount).to.equal(3);
|
126 | 119 | expect(onChange.lastCall.args[0]).toEqualDateTime(adapterToUse.date('2010-01-15T11:00:00'));
|
127 | 120 |
|
128 | 121 | // Change the minutes
|
129 |
| - const minuteClockEvent = getClockTouchEvent(53, 'minutes'); |
130 |
| - fireTouchChangedEvent(screen.getByTestId('clock'), 'touchmove', minuteClockEvent); |
131 |
| - fireTouchChangedEvent(screen.getByTestId('clock'), 'touchend', minuteClockEvent); |
| 122 | + fireEvent.click(screen.getByRole('option', { name: '55 minutes' })); |
132 | 123 | expect(onChange.callCount).to.equal(4);
|
133 |
| - expect(onChange.lastCall.args[0]).toEqualDateTime(adapterToUse.date('2010-01-15T11:53:00')); |
| 124 | + expect(onChange.lastCall.args[0]).toEqualDateTime(adapterToUse.date('2010-01-15T11:55:00')); |
134 | 125 | expect(onAccept.callCount).to.equal(0);
|
135 | 126 | expect(onClose.callCount).to.equal(0);
|
136 | 127 | });
|
|
0 commit comments