@patternfly/react-core 4.200.1 → 4.200.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +5 -5
- package/src/components/ChipGroup/__tests__/ChipGroup.test.tsx +14 -9
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyToggle.test.tsx +28 -19
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap +1 -1
- package/src/components/ContextSelector/__tests__/ContextSelector.test.tsx +21 -14
- package/src/components/ContextSelector/__tests__/ContextSelectorToggle.test.tsx +49 -34
- package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +2 -169
- package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelectorToggle.test.tsx.snap +5 -247
- package/src/components/DataList/__tests__/DataList.test.tsx +49 -40
- package/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +1 -9
- package/src/components/Dropdown/__tests__/Dropdown.test.tsx +54 -42
- package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +179 -177
- package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +51 -55
- package/src/components/Dropdown/__tests__/Generated/DropdownItem.test.tsx +28 -26
- package/src/components/Dropdown/__tests__/Generated/DropdownSeparator.test.tsx +14 -15
- package/src/components/Dropdown/__tests__/Generated/InternalDropdownItem.test.tsx +39 -36
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownItem.test.tsx.snap +6 -4
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownSeparator.test.tsx.snap +11 -4
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/InternalDropdownItem.test.tsx.snap +7 -4
- package/src/components/Dropdown/__tests__/InternalDropdownItem.test.tsx +66 -69
- package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +15 -816
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +9 -454
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggleCheckbox.test.tsx.snap +7 -141
- package/src/components/Dropdown/__tests__/__snapshots__/InternalDropdownItem.test.tsx.snap +10 -163
- package/src/components/Nav/__tests__/Generated/NavList.test.tsx +28 -18
- package/src/components/Nav/__tests__/Generated/__snapshots__/NavList.test.tsx.snap +8 -4
- package/src/components/OptionsMenu/__tests__/Generated/OptionsMenuItem.test.tsx +21 -19
- package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenuItem.test.tsx.snap +20 -11
- package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuDropdownItem.test.tsx +14 -10
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuDropdownItem.test.tsx.snap +18 -4
- package/src/components/Select/__tests__/Generated/SelectGroup.test.tsx +22 -10
- package/src/components/Select/__tests__/Generated/SelectMenu.test.tsx +22 -26
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectGroup.test.tsx.snap +15 -4
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +7 -19
- package/src/components/Select/__tests__/SelectGroup.test.tsx +14 -7
- package/src/components/Select/__tests__/SelectOption.test.tsx +51 -30
- package/src/components/Select/__tests__/__snapshots__/SelectGroup.test.tsx.snap +1 -5
- package/src/components/Select/__tests__/__snapshots__/SelectOption.test.tsx.snap +10 -272
- package/src/components/Toolbar/__tests__/Generated/ToolbarToggleGroup.test.tsx +25 -11
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarToggleGroup.test.tsx.snap +26 -4
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +129 -0
- package/src/components/Toolbar/__tests__/ToolbarItem.test.tsx +19 -0
- package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +12 -135
- package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +7 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.test.tsx.snap +3 -0
- package/src/components/Select/__tests__/Generated/SelectOption.test.tsx +0 -29
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectOption.test.tsx.snap +0 -7
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarToggleGroup.test.tsx.snap +0 -516
- package/src/components/Wizard/__tests__/Generated/Wizard.test.tsx +0 -43
- package/src/components/Wizard/__tests__/Generated/__snapshots__/Wizard.test.tsx.snap +0 -69
package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelectorToggle.test.tsx.snap
CHANGED
|
@@ -1,253 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Renders ContextSelectorToggle 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<button
|
|
6
|
-
aria-expanded="false"
|
|
7
|
-
class="pf-c-context-selector__toggle"
|
|
8
|
-
id="toggle-id"
|
|
9
|
-
type="button"
|
|
10
|
-
>
|
|
11
|
-
<span
|
|
12
|
-
class="pf-c-context-selector__toggle-text"
|
|
13
|
-
/>
|
|
14
|
-
<span
|
|
15
|
-
class="pf-c-context-selector__toggle-icon"
|
|
16
|
-
>
|
|
17
|
-
<svg
|
|
18
|
-
aria-hidden="true"
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
height="1em"
|
|
21
|
-
role="img"
|
|
22
|
-
style="vertical-align: -0.125em;"
|
|
23
|
-
viewBox="0 0 320 512"
|
|
24
|
-
width="1em"
|
|
25
|
-
>
|
|
26
|
-
<path
|
|
27
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
28
|
-
/>
|
|
29
|
-
</svg>
|
|
30
|
-
</span>
|
|
31
|
-
</button>
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
3
|
+
exports[`ContextSelectorToggle Renders ContextSelectorToggle 1`] = `"<button id=\\"toggle-id\\" class=\\"pf-c-context-selector__toggle\\" type=\\"button\\" aria-expanded=\\"false\\"><span class=\\"pf-c-context-selector__toggle-text\\"></span><span class=\\"pf-c-context-selector__toggle-icon\\"><svg style=\\"vertical-align: -0.125em;\\" fill=\\"currentColor\\" height=\\"1em\\" width=\\"1em\\" viewBox=\\"0 0 320 512\\" aria-hidden=\\"true\\" role=\\"img\\"><path d=\\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\\"></path></svg></span></button>"`;
|
|
34
4
|
|
|
35
|
-
exports[`Verify ESC press
|
|
36
|
-
<ContextSelectorToggle
|
|
37
|
-
className=""
|
|
38
|
-
id="toggle-id"
|
|
39
|
-
isActive={false}
|
|
40
|
-
isOpen={true}
|
|
41
|
-
onEnter={[Function]}
|
|
42
|
-
onToggle={[Function]}
|
|
43
|
-
parentRef={null}
|
|
44
|
-
toggleText=""
|
|
45
|
-
>
|
|
46
|
-
<button
|
|
47
|
-
aria-expanded={true}
|
|
48
|
-
className="pf-c-context-selector__toggle"
|
|
49
|
-
id="toggle-id"
|
|
50
|
-
onClick={[Function]}
|
|
51
|
-
onKeyDown={[Function]}
|
|
52
|
-
type="button"
|
|
53
|
-
>
|
|
54
|
-
<span
|
|
55
|
-
className="pf-c-context-selector__toggle-text"
|
|
56
|
-
/>
|
|
57
|
-
<span
|
|
58
|
-
className="pf-c-context-selector__toggle-icon"
|
|
59
|
-
>
|
|
60
|
-
<CaretDownIcon
|
|
61
|
-
aria-hidden={true}
|
|
62
|
-
color="currentColor"
|
|
63
|
-
noVerticalAlign={false}
|
|
64
|
-
size="sm"
|
|
65
|
-
>
|
|
66
|
-
<svg
|
|
67
|
-
aria-hidden={true}
|
|
68
|
-
aria-labelledby={null}
|
|
69
|
-
fill="currentColor"
|
|
70
|
-
height="1em"
|
|
71
|
-
role="img"
|
|
72
|
-
style={
|
|
73
|
-
Object {
|
|
74
|
-
"verticalAlign": "-0.125em",
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
viewBox="0 0 320 512"
|
|
78
|
-
width="1em"
|
|
79
|
-
>
|
|
80
|
-
<path
|
|
81
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
82
|
-
/>
|
|
83
|
-
</svg>
|
|
84
|
-
</CaretDownIcon>
|
|
85
|
-
</span>
|
|
86
|
-
</button>
|
|
87
|
-
</ContextSelectorToggle>
|
|
88
|
-
`;
|
|
5
|
+
exports[`ContextSelectorToggle Verify ESC press 1`] = `"<button id=\\"toggle-id\\" class=\\"pf-c-context-selector__toggle\\" type=\\"button\\" aria-expanded=\\"true\\"><span class=\\"pf-c-context-selector__toggle-text\\"></span><span class=\\"pf-c-context-selector__toggle-icon\\"><svg style=\\"vertical-align: -0.125em;\\" fill=\\"currentColor\\" height=\\"1em\\" width=\\"1em\\" viewBox=\\"0 0 320 512\\" aria-hidden=\\"true\\" role=\\"img\\"><path d=\\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\\"></path></svg></span></button>"`;
|
|
89
6
|
|
|
90
|
-
exports[`Verify ESC press with not isOpen 1`] = `
|
|
91
|
-
<ContextSelectorToggle
|
|
92
|
-
className=""
|
|
93
|
-
id="toggle-id"
|
|
94
|
-
isActive={false}
|
|
95
|
-
isOpen={false}
|
|
96
|
-
onEnter={[Function]}
|
|
97
|
-
onToggle={[MockFunction]}
|
|
98
|
-
parentRef={null}
|
|
99
|
-
toggleText=""
|
|
100
|
-
>
|
|
101
|
-
<button
|
|
102
|
-
aria-expanded={false}
|
|
103
|
-
className="pf-c-context-selector__toggle"
|
|
104
|
-
id="toggle-id"
|
|
105
|
-
onClick={[Function]}
|
|
106
|
-
onKeyDown={[Function]}
|
|
107
|
-
type="button"
|
|
108
|
-
>
|
|
109
|
-
<span
|
|
110
|
-
className="pf-c-context-selector__toggle-text"
|
|
111
|
-
/>
|
|
112
|
-
<span
|
|
113
|
-
className="pf-c-context-selector__toggle-icon"
|
|
114
|
-
>
|
|
115
|
-
<CaretDownIcon
|
|
116
|
-
aria-hidden={true}
|
|
117
|
-
color="currentColor"
|
|
118
|
-
noVerticalAlign={false}
|
|
119
|
-
size="sm"
|
|
120
|
-
>
|
|
121
|
-
<svg
|
|
122
|
-
aria-hidden={true}
|
|
123
|
-
aria-labelledby={null}
|
|
124
|
-
fill="currentColor"
|
|
125
|
-
height="1em"
|
|
126
|
-
role="img"
|
|
127
|
-
style={
|
|
128
|
-
Object {
|
|
129
|
-
"verticalAlign": "-0.125em",
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
viewBox="0 0 320 512"
|
|
133
|
-
width="1em"
|
|
134
|
-
>
|
|
135
|
-
<path
|
|
136
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
137
|
-
/>
|
|
138
|
-
</svg>
|
|
139
|
-
</CaretDownIcon>
|
|
140
|
-
</span>
|
|
141
|
-
</button>
|
|
142
|
-
</ContextSelectorToggle>
|
|
143
|
-
`;
|
|
7
|
+
exports[`ContextSelectorToggle Verify ESC press with not isOpen 1`] = `"<button id=\\"toggle-id\\" class=\\"pf-c-context-selector__toggle\\" type=\\"button\\" aria-expanded=\\"false\\"><span class=\\"pf-c-context-selector__toggle-text\\"></span><span class=\\"pf-c-context-selector__toggle-icon\\"><svg style=\\"vertical-align: -0.125em;\\" fill=\\"currentColor\\" height=\\"1em\\" width=\\"1em\\" viewBox=\\"0 0 320 512\\" aria-hidden=\\"true\\" role=\\"img\\"><path d=\\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\\"></path></svg></span></button>"`;
|
|
144
8
|
|
|
145
|
-
exports[`Verify keydown enter 1`] = `
|
|
146
|
-
<ContextSelectorToggle
|
|
147
|
-
className=""
|
|
148
|
-
id="toggle-id"
|
|
149
|
-
isActive={false}
|
|
150
|
-
isOpen={false}
|
|
151
|
-
onEnter={[MockFunction]}
|
|
152
|
-
onToggle={[MockFunction]}
|
|
153
|
-
parentRef={null}
|
|
154
|
-
toggleText=""
|
|
155
|
-
>
|
|
156
|
-
<button
|
|
157
|
-
aria-expanded={false}
|
|
158
|
-
className="pf-c-context-selector__toggle"
|
|
159
|
-
id="toggle-id"
|
|
160
|
-
onClick={[Function]}
|
|
161
|
-
onKeyDown={[Function]}
|
|
162
|
-
type="button"
|
|
163
|
-
>
|
|
164
|
-
<span
|
|
165
|
-
className="pf-c-context-selector__toggle-text"
|
|
166
|
-
/>
|
|
167
|
-
<span
|
|
168
|
-
className="pf-c-context-selector__toggle-icon"
|
|
169
|
-
>
|
|
170
|
-
<CaretDownIcon
|
|
171
|
-
aria-hidden={true}
|
|
172
|
-
color="currentColor"
|
|
173
|
-
noVerticalAlign={false}
|
|
174
|
-
size="sm"
|
|
175
|
-
>
|
|
176
|
-
<svg
|
|
177
|
-
aria-hidden={true}
|
|
178
|
-
aria-labelledby={null}
|
|
179
|
-
fill="currentColor"
|
|
180
|
-
height="1em"
|
|
181
|
-
role="img"
|
|
182
|
-
style={
|
|
183
|
-
Object {
|
|
184
|
-
"verticalAlign": "-0.125em",
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
viewBox="0 0 320 512"
|
|
188
|
-
width="1em"
|
|
189
|
-
>
|
|
190
|
-
<path
|
|
191
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
192
|
-
/>
|
|
193
|
-
</svg>
|
|
194
|
-
</CaretDownIcon>
|
|
195
|
-
</span>
|
|
196
|
-
</button>
|
|
197
|
-
</ContextSelectorToggle>
|
|
198
|
-
`;
|
|
9
|
+
exports[`ContextSelectorToggle Verify keydown enter 1`] = `"<button id=\\"toggle-id\\" class=\\"pf-c-context-selector__toggle\\" type=\\"button\\" aria-expanded=\\"false\\"><span class=\\"pf-c-context-selector__toggle-text\\"></span><span class=\\"pf-c-context-selector__toggle-icon\\"><svg style=\\"vertical-align: -0.125em;\\" fill=\\"currentColor\\" height=\\"1em\\" width=\\"1em\\" viewBox=\\"0 0 320 512\\" aria-hidden=\\"true\\" role=\\"img\\"><path d=\\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\\"></path></svg></span></button>"`;
|
|
199
10
|
|
|
200
|
-
exports[`Verify keydown tab 1`] = `
|
|
201
|
-
<ContextSelectorToggle
|
|
202
|
-
className=""
|
|
203
|
-
id="toggle-id"
|
|
204
|
-
isActive={false}
|
|
205
|
-
isOpen={true}
|
|
206
|
-
onEnter={[Function]}
|
|
207
|
-
onToggle={[Function]}
|
|
208
|
-
parentRef={null}
|
|
209
|
-
toggleText=""
|
|
210
|
-
>
|
|
211
|
-
<button
|
|
212
|
-
aria-expanded={true}
|
|
213
|
-
className="pf-c-context-selector__toggle"
|
|
214
|
-
id="toggle-id"
|
|
215
|
-
onClick={[Function]}
|
|
216
|
-
onKeyDown={[Function]}
|
|
217
|
-
type="button"
|
|
218
|
-
>
|
|
219
|
-
<span
|
|
220
|
-
className="pf-c-context-selector__toggle-text"
|
|
221
|
-
/>
|
|
222
|
-
<span
|
|
223
|
-
className="pf-c-context-selector__toggle-icon"
|
|
224
|
-
>
|
|
225
|
-
<CaretDownIcon
|
|
226
|
-
aria-hidden={true}
|
|
227
|
-
color="currentColor"
|
|
228
|
-
noVerticalAlign={false}
|
|
229
|
-
size="sm"
|
|
230
|
-
>
|
|
231
|
-
<svg
|
|
232
|
-
aria-hidden={true}
|
|
233
|
-
aria-labelledby={null}
|
|
234
|
-
fill="currentColor"
|
|
235
|
-
height="1em"
|
|
236
|
-
role="img"
|
|
237
|
-
style={
|
|
238
|
-
Object {
|
|
239
|
-
"verticalAlign": "-0.125em",
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
viewBox="0 0 320 512"
|
|
243
|
-
width="1em"
|
|
244
|
-
>
|
|
245
|
-
<path
|
|
246
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
247
|
-
/>
|
|
248
|
-
</svg>
|
|
249
|
-
</CaretDownIcon>
|
|
250
|
-
</span>
|
|
251
|
-
</button>
|
|
252
|
-
</ContextSelectorToggle>
|
|
253
|
-
`;
|
|
11
|
+
exports[`ContextSelectorToggle Verify keydown tab 1`] = `"<button id=\\"toggle-id\\" class=\\"pf-c-context-selector__toggle\\" type=\\"button\\" aria-expanded=\\"true\\"><span class=\\"pf-c-context-selector__toggle-text\\"></span><span class=\\"pf-c-context-selector__toggle-icon\\"><svg style=\\"vertical-align: -0.125em;\\" fill=\\"currentColor\\" height=\\"1em\\" width=\\"1em\\" viewBox=\\"0 0 320 512\\" aria-hidden=\\"true\\" role=\\"img\\"><path d=\\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\\"></path></svg></span></button>"`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
|
|
4
5
|
import { DataList } from '../DataList';
|
|
5
6
|
import { DataListItem } from '../DataListItem';
|
|
6
7
|
import { DataListAction } from '../DataListAction';
|
|
@@ -26,9 +27,7 @@ describe('DataList', () => {
|
|
|
26
27
|
describe('DataList variants', () => {
|
|
27
28
|
['none', 'always', 'sm', 'md', 'lg', 'xl', '2xl'].forEach(oneBreakpoint => {
|
|
28
29
|
test(`Breakpoint - ${oneBreakpoint}`, () => {
|
|
29
|
-
const view = render(
|
|
30
|
-
<DataList aria-label="this is a simple list" gridBreakpoint={oneBreakpoint as any} />
|
|
31
|
-
);
|
|
30
|
+
const view = render(<DataList aria-label="this is a simple list" gridBreakpoint={oneBreakpoint as any} />);
|
|
32
31
|
expect(view.container).toMatchSnapshot();
|
|
33
32
|
});
|
|
34
33
|
});
|
|
@@ -45,21 +44,21 @@ describe('DataList', () => {
|
|
|
45
44
|
});
|
|
46
45
|
|
|
47
46
|
test('Item default', () => {
|
|
48
|
-
|
|
47
|
+
render(
|
|
49
48
|
<DataListItem key="item-id-1" aria-labelledby="item-1">
|
|
50
49
|
test
|
|
51
50
|
</DataListItem>
|
|
52
51
|
);
|
|
53
|
-
expect(
|
|
52
|
+
expect(screen.getByRole('listitem').outerHTML).toMatchSnapshot();
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
test('Item expanded', () => {
|
|
57
|
-
|
|
56
|
+
render(
|
|
58
57
|
<DataListItem aria-labelledby="item-1" isExpanded>
|
|
59
58
|
test
|
|
60
59
|
</DataListItem>
|
|
61
60
|
);
|
|
62
|
-
expect(
|
|
61
|
+
expect(screen.getByRole('listitem').className).toBe('pf-c-data-list__item pf-m-expanded');
|
|
63
62
|
});
|
|
64
63
|
|
|
65
64
|
test('Item', () => {
|
|
@@ -99,54 +98,62 @@ describe('DataList', () => {
|
|
|
99
98
|
|
|
100
99
|
test('Cell with width modifier', () => {
|
|
101
100
|
[
|
|
102
|
-
{ width: 1
|
|
103
|
-
{ width: 2
|
|
104
|
-
{ width: 3
|
|
105
|
-
{ width: 4
|
|
106
|
-
{ width: 5
|
|
107
|
-
].forEach(testCase => {
|
|
108
|
-
const
|
|
109
|
-
|
|
101
|
+
{ width: 1, class: '' },
|
|
102
|
+
{ width: 2, class: 'pf-m-flex-2' },
|
|
103
|
+
{ width: 3, class: 'pf-m-flex-3' },
|
|
104
|
+
{ width: 4, class: 'pf-m-flex-4' },
|
|
105
|
+
{ width: 5, class: 'pf-m-flex-5' }
|
|
106
|
+
].forEach((testCase, index) => {
|
|
107
|
+
const testId = `cell-test-id-${index}`;
|
|
108
|
+
|
|
109
|
+
render(
|
|
110
|
+
<DataListCell data-testid={testId} width={testCase.width as any} key={index}>
|
|
110
111
|
Primary Id
|
|
111
112
|
</DataListCell>
|
|
112
113
|
);
|
|
114
|
+
|
|
115
|
+
const dataListCell = screen.getByTestId(testId);
|
|
116
|
+
|
|
113
117
|
testCase.class === ''
|
|
114
|
-
? expect(
|
|
115
|
-
: expect(
|
|
118
|
+
? expect(dataListCell.className).toBe('pf-c-data-list__cell')
|
|
119
|
+
: expect(dataListCell.className).toBe(`pf-c-data-list__cell ${testCase.class}`);
|
|
116
120
|
});
|
|
117
121
|
});
|
|
118
122
|
|
|
119
123
|
test('Cell with text modifiers', () => {
|
|
120
124
|
[
|
|
121
125
|
{ wrapModifier: null as any, class: '' },
|
|
122
|
-
{ wrapModifier: 'breakWord'
|
|
123
|
-
{ wrapModifier: 'nowrap'
|
|
124
|
-
{ wrapModifier: 'truncate'
|
|
125
|
-
].forEach(testCase => {
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
{ wrapModifier: 'breakWord', class: 'pf-m-break-word' },
|
|
127
|
+
{ wrapModifier: 'nowrap', class: 'pf-m-nowrap' },
|
|
128
|
+
{ wrapModifier: 'truncate', class: 'pf-m-truncate' }
|
|
129
|
+
].forEach((testCase, index) => {
|
|
130
|
+
const testId = `cell-test-id-${index}`;
|
|
131
|
+
|
|
132
|
+
render(
|
|
133
|
+
<DataListCell data-testid={testId} wrapModifier={testCase.wrapModifier} key={index}>
|
|
128
134
|
Primary Id
|
|
129
135
|
</DataListCell>
|
|
130
136
|
);
|
|
137
|
+
|
|
138
|
+
const dataListCell = screen.getByTestId(testId);
|
|
139
|
+
|
|
131
140
|
testCase.class === ''
|
|
132
|
-
? expect(
|
|
133
|
-
: expect(
|
|
141
|
+
? expect(dataListCell.className).toBe('pf-c-data-list__cell')
|
|
142
|
+
: expect(dataListCell.className).toBe(`pf-c-data-list__cell ${testCase.class}`);
|
|
134
143
|
});
|
|
135
144
|
});
|
|
136
145
|
|
|
137
146
|
test('Toggle default with aria label', () => {
|
|
138
|
-
|
|
147
|
+
render(<DataListToggle aria-label="Toggle details for" id="ex-toggle2" />);
|
|
139
148
|
|
|
140
|
-
expect(
|
|
141
|
-
expect(
|
|
142
|
-
expect(
|
|
143
|
-
expect(view.find(Button).props().id).toBe('ex-toggle2');
|
|
144
|
-
expect(view.find(Button).props().id).toBe('ex-toggle2');
|
|
149
|
+
expect(screen.getByRole('button').getAttribute('aria-labelledby')).toEqual(null);
|
|
150
|
+
expect(screen.getByRole('button').getAttribute('aria-label')).toEqual('Toggle details for');
|
|
151
|
+
expect(screen.getByRole('button').getAttribute('aria-expanded')).toEqual('false');
|
|
145
152
|
});
|
|
146
153
|
|
|
147
154
|
test('Toggle expanded', () => {
|
|
148
|
-
|
|
149
|
-
expect(
|
|
155
|
+
render(<DataListToggle aria-label="Toggle details for" id="ex-toggle2" isExpanded />);
|
|
156
|
+
expect(screen.getByRole('button').getAttribute('aria-expanded')).toEqual('true');
|
|
150
157
|
});
|
|
151
158
|
|
|
152
159
|
test('DataListAction dropdown', () => {
|
|
@@ -180,7 +187,7 @@ describe('DataList', () => {
|
|
|
180
187
|
});
|
|
181
188
|
|
|
182
189
|
test('DataListAction visibility - show button when lg', () => {
|
|
183
|
-
|
|
190
|
+
render(
|
|
184
191
|
<DataListAction
|
|
185
192
|
visibility={{ default: 'hidden', lg: 'visible' }}
|
|
186
193
|
aria-labelledby="check-action-item2 check-action-action2"
|
|
@@ -190,12 +197,13 @@ describe('DataList', () => {
|
|
|
190
197
|
<Button variant="primary">Primary</Button>
|
|
191
198
|
</DataListAction>
|
|
192
199
|
);
|
|
193
|
-
|
|
194
|
-
expect(
|
|
200
|
+
|
|
201
|
+
expect(screen.getByRole('button').parentElement.className).toContain('pf-m-hidden');
|
|
202
|
+
expect(screen.getByRole('button').parentElement.className).toContain('pf-m-visible-on-lg');
|
|
195
203
|
});
|
|
196
204
|
|
|
197
205
|
test('DataListAction visibility - hide button on 2xl', () => {
|
|
198
|
-
|
|
206
|
+
render(
|
|
199
207
|
<DataListAction
|
|
200
208
|
visibility={{ '2xl': 'hidden' }}
|
|
201
209
|
aria-labelledby="check-action-item2 check-action-action2"
|
|
@@ -205,7 +213,8 @@ describe('DataList', () => {
|
|
|
205
213
|
<Button variant="primary">Primary</Button>
|
|
206
214
|
</DataListAction>
|
|
207
215
|
);
|
|
208
|
-
|
|
216
|
+
|
|
217
|
+
expect(screen.getByRole('button').parentElement.className).toContain('pf-m-hidden-on-2xl');
|
|
209
218
|
});
|
|
210
219
|
|
|
211
220
|
test('DataListContent', () => {
|
|
@@ -199,15 +199,7 @@ exports[`DataList Item 1`] = `
|
|
|
199
199
|
</div>
|
|
200
200
|
`;
|
|
201
201
|
|
|
202
|
-
exports[`DataList Item default 1`] = `
|
|
203
|
-
<div>
|
|
204
|
-
<li
|
|
205
|
-
aria-labelledby="item-1"
|
|
206
|
-
class="pf-c-data-list__item"
|
|
207
|
-
id=""
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
`;
|
|
202
|
+
exports[`DataList Item default 1`] = `"<li id=\\"\\" class=\\"pf-c-data-list__item\\" aria-labelledby=\\"item-1\\"></li>"`;
|
|
211
203
|
|
|
212
204
|
exports[`DataList List 1`] = `
|
|
213
205
|
<div>
|