-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathChatbotHeaderMenu.test.tsx
More file actions
26 lines (21 loc) · 1.04 KB
/
ChatbotHeaderMenu.test.tsx
File metadata and controls
26 lines (21 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { fireEvent, render, screen } from '@testing-library/react';
import { ChatbotHeaderMenu } from './ChatbotHeaderMenu';
import '@testing-library/jest-dom';
describe('ChatbotHeaderMenu', () => {
it('should render ChatbotHeaderMenu with custom class', () => {
const { container } = render(<ChatbotHeaderMenu className="custom-header-menu" onMenuToggle={jest.fn()} />);
expect(container.querySelector('.custom-header-menu')).toBeTruthy();
});
it('should call onMenuToggle when ChatbotHeaderMenu button is clicked', () => {
const onMenuToggle = jest.fn();
render(<ChatbotHeaderMenu className="custom-header-menu" onMenuToggle={onMenuToggle} />);
fireEvent.click(screen.getByRole('button', { name: 'Chat history drawer' }));
expect(onMenuToggle).toHaveBeenCalled();
});
it('should handle isCompact', () => {
render(
<ChatbotHeaderMenu className="custom-header-menu" onMenuToggle={jest.fn()} isCompact data-testid="button" />
);
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
});
});