Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Dec 2, 2024
1 parent d93c25b commit df85077
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
expectFieldValueV7,
buildFieldInteractions,
openPicker,
getFieldSectionsContainer,
} from 'test/utils/pickers';

describe('<MobileDatePicker />', () => {
Expand Down Expand Up @@ -132,17 +131,6 @@ describe('<MobileDatePicker />', () => {
});

describe('picker state', () => {
it('should open when clicking the input', () => {
const onOpen = spy();

render(<MobileDatePicker onOpen={onOpen} />);

fireEvent.click(getFieldSectionsContainer());

expect(onOpen.callCount).to.equal(1);
expect(screen.queryByRole('dialog')).toBeVisible();
});

it('should call `onAccept` even if controlled', () => {
const onAccept = spy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
createPickerRenderer,
openPicker,
getClockTouchEvent,
getFieldSectionsContainer,
} from 'test/utils/pickers';

describe('<MobileDateTimePicker />', () => {
Expand Down Expand Up @@ -83,17 +82,6 @@ describe('<MobileDateTimePicker />', () => {
});

describe('picker state', () => {
it('should open when clicking the input', () => {
const onOpen = spy();

render(<MobileDateTimePicker onOpen={onOpen} />);

fireEvent.click(getFieldSectionsContainer());

expect(onOpen.callCount).to.equal(1);
expect(screen.queryByRole('dialog')).toBeVisible();
});

it('should call onChange when selecting each view', function test() {
if (typeof window.Touch === 'undefined' || typeof window.TouchEvent === 'undefined') {
this.skip();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@ import {
adapterToUse,
openPicker,
getClockTouchEvent,
getFieldSectionsContainer,
} from 'test/utils/pickers';

describe('<MobileTimePicker />', () => {
const { render } = createPickerRenderer({ clock: 'fake' });

describe('picker state', () => {
it('should open when clicking the input', () => {
const onOpen = spy();

render(<MobileTimePicker onOpen={onOpen} />);

fireEvent.click(getFieldSectionsContainer());

expect(onOpen.callCount).to.equal(1);
expect(screen.queryByRole('dialog')).toBeVisible();
});

it('should fire a change event when meridiem changes', () => {
const handleChange = spy();
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const testControlledUnControlled: DescribeValueTestSuite<any, any> = (
});
});

it('should not allow editing with keyboard in mobile pickers', () => {
it('should allow editing with keyboard in mobile pickers', () => {
if (componentFamily !== 'picker' || params.variant !== 'mobile') {
return;
}
Expand All @@ -170,7 +170,7 @@ export const testControlledUnControlled: DescribeValueTestSuite<any, any> = (
});
v7Response.selectSection(undefined);
fireUserEvent.keyPress(v7Response.getActiveSection(0), { key: 'ArrowUp' });
expect(handleChange.callCount).to.equal(0);
expect(handleChange.callCount).to.equal(1);
});

it('should have correct labelledby relationship when toolbar is shown', () => {
Expand Down

0 comments on commit df85077

Please sign in to comment.