Files
ionic-framework/packages/react/test/base/src/OutputTarget.test.tsx
Sean Perkins 3e191df3dd fix(react): onDoubleClick fires on components (#27611)
Issue number: Resolves #21320

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

`onDoubleClick` bindings on Ionic components do not fire when the
element is double clicked.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- `onDoubleClick` fires on Ionic components
- Fixed the unit testing set-up for the react test apps

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-06-08 18:35:25 +00:00

15 lines
419 B
TypeScript

import { IonButton } from '@ionic/react';
import { fireEvent, render, screen } from '@testing-library/react';
import React from 'react';
test('should support onDoubleClick bindings', () => {
const mockFn = jest.fn();
render(<IonButton onDoubleClick={mockFn}>Click me</IonButton>);
// Simulate a double click on the button
fireEvent.dblClick(screen.getByText('Click me'));
expect(mockFn).toBeCalled();
});