-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathCompanionWindowFactory.test.jsx
More file actions
88 lines (72 loc) · 2.36 KB
/
CompanionWindowFactory.test.jsx
File metadata and controls
88 lines (72 loc) · 2.36 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { render, screen } from '@tests/utils/test-utils';
import { CompanionWindowFactory } from '../../../src/components/CompanionWindowFactory';
/** create wrapper */
function createWrapper({ content = 'closed', ...props }) {
return render(
<CompanionWindowFactory
windowId="x"
id="123"
content={content}
{...props}
/>,
{ preloadedState: { companionWindows: { 123: { content }, thumb: {} }, windows: { x: { thumbnailNavigationId: 'thumb' } } } },
);
}
describe('CompanionWindowFactory', () => {
describe('for an info window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'info',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('About this item');
});
});
describe('for a canvas navigation window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'canvas',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Index');
});
});
describe('for an annotation window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'annotations',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Annotations');
});
});
describe('for an attribution window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'attribution',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Rights');
});
});
describe('for the thumbnail nav window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'thumbnailNavigation',
});
expect(screen.getByLabelText('Thumbnails')).toBeInTheDocument();
});
});
describe('for the search window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'search',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Search');
});
});
describe('for the layers window', () => {
it('renders the appropriate arg component', () => {
createWrapper({
content: 'layers',
});
expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Layers');
});
});
});