Skip to content

Commit dca4fac

Browse files
Adjust tests
1 parent f810bfb commit dca4fac

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/components/MessageActions/__tests__/MessageActions.test.jsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
33
import { axe } from '../../../../axe-helper';
44

55
import { MessageActions } from '../MessageActions';
6+
import { defaultMessageActionSet } from '../MessageActions.defaults';
67

78
import {
89
ChannelActionProvider,
@@ -799,9 +800,13 @@ describe('<MessageActions />', () => {
799800
});
800801

801802
describe('Custom message action sets', () => {
802-
it('should render custom action components', async () => {
803+
it('should render custom dropdown action components', async () => {
803804
const CustomAction = () => <button data-testid='custom-action'>Custom</button>;
804805
const customMessageActionSet = [
806+
// include default toggle
807+
defaultMessageActionSet.find(
808+
({ placement }) => placement === 'quick-dropdown-toggle',
809+
),
805810
{
806811
Component: CustomAction,
807812
placement: 'dropdown',
@@ -820,7 +825,7 @@ describe('<MessageActions />', () => {
820825
expect(screen.getByTestId('custom-action')).toBeInTheDocument();
821826
});
822827

823-
it('should support custom quick actions', async () => {
828+
it('should render custom quick action components', async () => {
824829
const CustomQuickAction = () => (
825830
<button data-testid='custom-quick-action'>Quick</button>
826831
);
@@ -842,6 +847,31 @@ describe('<MessageActions />', () => {
842847
expect(screen.getByTestId('custom-quick-action')).toBeInTheDocument();
843848
});
844849

850+
it('should render custom quick-dropdown-toggle component', async () => {
851+
const CustomQuickDropdownToggle = () => (
852+
<button data-testid='custom-quick-dropdown-toggle'>Toggle</button>
853+
);
854+
const customMessageActionSet = [
855+
{
856+
Component: vi.fn(),
857+
placement: 'dropdown',
858+
},
859+
{
860+
Component: CustomQuickDropdownToggle,
861+
placement: 'quick-dropdown-toggle',
862+
},
863+
];
864+
865+
await renderMessageActions({
866+
messageActionsProps: {
867+
disableBaseMessageActionSetFilter: true,
868+
messageActionSet: customMessageActionSet,
869+
},
870+
});
871+
872+
expect(screen.getByTestId('custom-quick-dropdown-toggle')).toBeInTheDocument();
873+
});
874+
845875
it('should allow disabling base filter', async () => {
846876
const message = generateMessage({ status: 'failed' });
847877
const { container } = await renderMessageActions({

0 commit comments

Comments
 (0)