forked from patternfly/react-component-groups
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShortcut.test.tsx
More file actions
27 lines (24 loc) · 967 Bytes
/
Shortcut.test.tsx
File metadata and controls
27 lines (24 loc) · 967 Bytes
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
27
import { render, screen } from '@testing-library/react';
import Shortcut from './Shortcut';
describe('Shortcut component', () => {
it('should render correctly', () => {
expect(render(<Shortcut description='Shortcut description' keys={[ 'cmd', 'shift' ]} click/>)).toMatchSnapshot();
});
it('should render custom i18n labels for mouse actions', () => {
render(
<Shortcut
keys={[]}
hover hoverLabel="Survoler"
click clickLabel="Cliquer"
rightClick rightClickLabel="Clic droit"
drag dragLabel="Glisser"
dragAndDrop dragAndDropLabel="Glisser + Déposer"
/>
);
expect(screen.getByText('Survoler')).toBeInTheDocument();
expect(screen.getByText('Cliquer')).toBeInTheDocument();
expect(screen.getByText('Clic droit')).toBeInTheDocument();
expect(screen.getByText('Glisser')).toBeInTheDocument();
expect(screen.getByText('Glisser + Déposer')).toBeInTheDocument();
});
});