@patternfly/react-core 5.2.0-prerelease.27 → 5.2.0-prerelease.29
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/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/esm/components/Button/Button.d.ts +1 -1
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts +1 -1
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +2 -2
- package/dist/js/components/Button/Button.js.map +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +3 -3
- package/src/components/AboutModal/__tests__/AboutModalBox.test.tsx +1 -5
- package/src/components/Accordion/__tests__/AccordionItem.test.tsx +1 -3
- package/src/components/Alert/__tests__/AlertGroup.test.tsx +1 -1
- package/src/components/BackToTop/__tests__/BackToTop.test.tsx +2 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Button/__tests__/Button.test.tsx +0 -1
- package/src/components/CalendarMonth/__tests__/CalendarMonth.test.tsx +3 -1
- package/src/components/Card/__tests__/CardBody.test.tsx +1 -1
- package/src/components/Card/__tests__/CardFooter.test.tsx +1 -1
- package/src/components/Chip/__tests__/ChipGroup.test.tsx +1 -5
- package/src/components/ClipboardCopy/__tests__/ClipboardCopyToggle.test.tsx +0 -1
- package/src/components/DatePicker/__tests__/DatePicker.test.tsx +3 -7
- package/src/components/Divider/__tests__/Divider.test.tsx +2 -13
- package/src/components/Drawer/__tests__/Drawer.test.tsx +4 -8
- package/src/components/Dropdown/__tests__/Dropdown.test.tsx +3 -3
- package/src/components/Form/__tests__/FormContext.test.tsx +39 -50
- package/src/components/Form/__tests__/FormFieldGroup.test.tsx +1 -1
- package/src/components/Form/__tests__/FormGroup.test.tsx +0 -1
- package/src/components/Form/__tests__/FormHelperText.test.tsx +0 -1
- package/src/components/HelperText/__tests__/HelperText.test.tsx +2 -2
- package/src/components/Icon/__tests__/Icon.test.tsx +2 -2
- package/src/components/InputGroup/__tests__/InputGroup.test.tsx +2 -2
- package/src/components/Masthead/__tests__/Masthead.test.tsx +1 -1
- package/src/components/Menu/__tests__/Menu.test.tsx +2 -3
- package/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +18 -16
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatus.test.tsx +1 -1
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatusItem.test.tsx +1 -1
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitle.test.tsx +1 -1
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleIcon.test.tsx +1 -1
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleText.test.tsx +1 -1
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleTextSeparator.test.tsx +1 -1
- package/src/components/Nav/__tests__/Nav.test.tsx +14 -14
- package/src/components/Nav/examples/NavFlyout.tsx +1 -1
- package/src/components/Nav/examples/NavHorizontalSubNav.tsx +1 -1
- package/src/components/Nav/examples/NavLegacyTertiary.tsx +1 -1
- package/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx +1 -1
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerGroup.test.tsx +3 -1
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItem.test.tsx +1 -3
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemHeader.test.tsx +1 -1
- package/src/components/NumberInput/__tests__/NumberInput.test.tsx +6 -6
- package/src/components/Pagination/__tests__/Pagination.test.tsx +4 -2
- package/src/components/Pagination/examples/PaginationSticky.tsx +2 -2
- package/src/components/Panel/__tests__/Panel.test.tsx +2 -2
- package/src/components/Popover/__tests__/Popover.test.tsx +1 -1
- package/src/components/Progress/__tests__/Progress.test.tsx +5 -5
- package/src/components/ProgressStepper/__tests__/ProgressStep.test.tsx +1 -1
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +9 -12
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +0 -69
- package/src/components/SkipToContent/__tests__/SkipToContent.test.tsx +0 -1
- package/src/components/Spinner/__tests__/Spinner.test.tsx +1 -1
- package/src/components/Switch/__tests__/Switch.test.tsx +1 -1
- package/src/components/Tabs/__tests__/OverflowTab.test.tsx +1 -1
- package/src/components/Tabs/__tests__/Tabs.test.tsx +5 -5
- package/src/components/TextInput/__tests__/TextInput.test.tsx +6 -4
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +4 -10
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +2 -2
- package/src/components/Toolbar/__tests__/ToolbarGroup.test.tsx +5 -1
- package/src/components/Toolbar/__tests__/ToolbarItem.test.tsx +5 -1
- package/src/components/TreeView/__tests__/TreeView.test.tsx +3 -4
- package/src/components/Wizard/__tests__/WizardToggle.test.tsx +2 -2
- package/src/components/Wizard/__tests__/utils.test.tsx +1 -1
- package/src/demos/Banner.md +4 -4
- package/src/demos/examples/BackToTop/BackToTopNameDemo.tsx +3 -3
- package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +2 -2
- package/src/demos/examples/Nav/NavDefault.tsx +1 -1
- package/src/demos/examples/Nav/NavExpandable.tsx +1 -1
- package/src/demos/examples/Nav/NavHorizontal.tsx +1 -1
- package/src/demos/examples/Nav/NavHorizontalWithSubnav.tsx +1 -1
- package/src/demos/examples/Nav/NavManual.tsx +1 -1
- package/src/demos/examples/Nav/NavWithSubnav.tsx +1 -1
- package/src/demos/examples/Nav/deprecated/NavLight.tsx +1 -1
- package/src/demos/examples/Nav/deprecated/NavTertiary.tsx +1 -1
- package/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx +2 -2
- package/src/demos/examples/Page/PageStickySectionGroup.tsx +2 -2
- package/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx +2 -2
- package/src/demos/examples/Wizard/InModal.tsx +2 -2
- package/src/deprecated/components/ContextSelector/__tests__/ContextSelectorToggle.test.tsx +4 -4
- package/src/deprecated/components/Dropdown/__tests__/DropdownToggle.test.tsx +1 -1
- package/src/deprecated/components/Select/__tests__/Select.test.tsx +1 -1
- package/src/deprecated/components/Wizard/__tests__/Wizard.test.tsx +3 -3
- package/src/helpers/GenerateId/__tests__/GenerateId.test.tsx +1 -1
- package/src/helpers/OUIA/__mocks__/ouia.ts +6 -0
- package/src/helpers/__mocks__/index.ts +2 -0
- package/src/helpers/__tests__/fileUtils.test.ts +6 -9
- package/src/helpers/__tests__/util.test.ts +1 -1
- package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +1 -1
- package/src/layouts/Grid/__tests__/GridItem.test.tsx +1 -1
|
@@ -3,9 +3,8 @@ import { render, screen } from '@testing-library/react';
|
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { FormContextConsumer, FormContextProvider } from '../FormContext';
|
|
5
5
|
|
|
6
|
-
const customRender = (ui, initialValues?: Record<string, any>) =>
|
|
7
|
-
|
|
8
|
-
};
|
|
6
|
+
const customRender = (ui, initialValues?: Record<string, any>) =>
|
|
7
|
+
render(<FormContextProvider initialValues={initialValues}>{ui}</FormContextProvider>);
|
|
9
8
|
|
|
10
9
|
test('consumers can show all values from "values" provided by "initialValues"', () => {
|
|
11
10
|
const initialValues = { fieldOneId: 'some value', fieldTwoId: 'some other value' };
|
|
@@ -63,9 +62,9 @@ test('sets a new value for a single field using setValue', async () => {
|
|
|
63
62
|
|
|
64
63
|
customRender(
|
|
65
64
|
<FormContextConsumer>
|
|
66
|
-
{({ getValue, setValue }) =>
|
|
67
|
-
|
|
68
|
-
}
|
|
65
|
+
{({ getValue, setValue }) => (
|
|
66
|
+
<input onChange={(event) => setValue('someId', event.target.value)} value={getValue('someId')} />
|
|
67
|
+
)}
|
|
69
68
|
</FormContextConsumer>,
|
|
70
69
|
{
|
|
71
70
|
someId: 'some value'
|
|
@@ -86,16 +85,14 @@ test('using setValues, consumers can set multiple values at once', async () => {
|
|
|
86
85
|
|
|
87
86
|
customRender(
|
|
88
87
|
<FormContextConsumer>
|
|
89
|
-
{({ values, setValues }) =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
98
|
-
}}
|
|
88
|
+
{({ values, setValues }) => (
|
|
89
|
+
<>
|
|
90
|
+
<input type="checkbox" onClick={() => setValues(newValues)} />
|
|
91
|
+
{Object.entries(values).map(([fieldId, value]) => (
|
|
92
|
+
<span key={fieldId}>{`${fieldId}: ${value}`}</span>
|
|
93
|
+
))}
|
|
94
|
+
</>
|
|
95
|
+
)}
|
|
99
96
|
</FormContextConsumer>,
|
|
100
97
|
{
|
|
101
98
|
someId: 'some value'
|
|
@@ -129,14 +126,12 @@ test('sets a new error for a single field using setError', async () => {
|
|
|
129
126
|
|
|
130
127
|
customRender(
|
|
131
128
|
<FormContextConsumer>
|
|
132
|
-
{({ errors, setError }) =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
);
|
|
139
|
-
}}
|
|
129
|
+
{({ errors, setError }) => (
|
|
130
|
+
<>
|
|
131
|
+
<input type="checkbox" onClick={() => setError('someId', 'some error!')} />
|
|
132
|
+
{`Error: ${errors.someId}`}
|
|
133
|
+
</>
|
|
134
|
+
)}
|
|
140
135
|
</FormContextConsumer>
|
|
141
136
|
);
|
|
142
137
|
|
|
@@ -150,16 +145,14 @@ test('using setErrors, consumers can set multiple errors at once', async () => {
|
|
|
150
145
|
|
|
151
146
|
customRender(
|
|
152
147
|
<FormContextConsumer>
|
|
153
|
-
{({ errors, setErrors }) =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
);
|
|
162
|
-
}}
|
|
148
|
+
{({ errors, setErrors }) => (
|
|
149
|
+
<>
|
|
150
|
+
<input type="checkbox" onClick={() => setErrors(newErrors)} />
|
|
151
|
+
{Object.entries(errors).map(([fieldId, error]) => (
|
|
152
|
+
<span key={fieldId}>{`${fieldId}: ${error}`}</span>
|
|
153
|
+
))}
|
|
154
|
+
</>
|
|
155
|
+
)}
|
|
163
156
|
</FormContextConsumer>,
|
|
164
157
|
{
|
|
165
158
|
someId: 'some value'
|
|
@@ -175,14 +168,12 @@ test('sets a new touched state for a single field using setTouched', async () =>
|
|
|
175
168
|
|
|
176
169
|
customRender(
|
|
177
170
|
<FormContextConsumer>
|
|
178
|
-
{({ touched, setTouched }) =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
);
|
|
185
|
-
}}
|
|
171
|
+
{({ touched, setTouched }) => (
|
|
172
|
+
<>
|
|
173
|
+
<input type="checkbox" onClick={() => setTouched('someId', true)} />
|
|
174
|
+
{`isTouched: ${touched.someId}`}
|
|
175
|
+
</>
|
|
176
|
+
)}
|
|
186
177
|
</FormContextConsumer>
|
|
187
178
|
);
|
|
188
179
|
|
|
@@ -195,14 +186,12 @@ test("can get a single field's touched state by using isTouched", async () => {
|
|
|
195
186
|
|
|
196
187
|
customRender(
|
|
197
188
|
<FormContextConsumer>
|
|
198
|
-
{({ touched, setTouched, isTouched }) =>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
);
|
|
205
|
-
}}
|
|
189
|
+
{({ touched, setTouched, isTouched }) => (
|
|
190
|
+
<>
|
|
191
|
+
<input type="checkbox" onClick={() => setTouched('someId', !touched.someId)} />
|
|
192
|
+
{`isTouched: ${isTouched('someId')}`}
|
|
193
|
+
</>
|
|
194
|
+
)}
|
|
206
195
|
</FormContextConsumer>
|
|
207
196
|
);
|
|
208
197
|
|
|
@@ -50,7 +50,7 @@ test('Verify console error logged when there is no aria-label or title', () => {
|
|
|
50
50
|
header={<FormFieldGroupHeader titleDescription="Field group 4 description text." actions={<Button />} />}
|
|
51
51
|
/>
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
render(FieldGroup);
|
|
54
54
|
expect(consoleErrorMock).toHaveBeenCalled();
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
|
|
6
|
-
import { ValidatedOptions } from '../../../helpers/constants';
|
|
7
6
|
import { FormGroup } from '../FormGroup';
|
|
8
7
|
import { Form } from '../Form';
|
|
9
8
|
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { HelperText } from '../HelperText';
|
|
4
4
|
import { HelperTextItem } from '../HelperTextItem';
|
|
5
|
-
import
|
|
5
|
+
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
6
6
|
|
|
7
7
|
describe('HelperText', () => {
|
|
8
8
|
test('simple helper text renders successfully', () => {
|
|
@@ -14,7 +14,7 @@ describe('HelperText', () => {
|
|
|
14
14
|
expect(asFragment()).toMatchSnapshot();
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
Object.values(['default', 'indeterminate', 'warning', 'success', 'invalid']).forEach(variant => {
|
|
17
|
+
Object.values(['default', 'indeterminate', 'warning', 'success', 'invalid']).forEach((variant) => {
|
|
18
18
|
test(`${variant} helper text variant applies successfully`, () => {
|
|
19
19
|
const { asFragment } = render(
|
|
20
20
|
<HelperTextItem variant={variant as 'default' | 'indeterminate' | 'warning' | 'success' | 'error'}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Icon } from '../Icon';
|
|
4
|
-
import
|
|
4
|
+
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
5
5
|
import styles from '@patternfly/react-styles/css/components/Icon/icon';
|
|
6
6
|
|
|
7
7
|
test('renders basic icon successfully', () => {
|
|
@@ -14,7 +14,7 @@ test('renders basic icon successfully', () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
test('checks basic icon structure', () => {
|
|
17
|
-
|
|
17
|
+
render(
|
|
18
18
|
<Icon title="icon">
|
|
19
19
|
<CheckIcon />
|
|
20
20
|
</Icon>
|
|
@@ -23,7 +23,7 @@ describe('InputGroup', () => {
|
|
|
23
23
|
</InputGroup>
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
const formControl = screen.getByLabelText(
|
|
27
|
-
expect(formControl).not.toHaveAttribute(
|
|
26
|
+
const formControl = screen.getByLabelText('User password');
|
|
27
|
+
expect(formControl).not.toHaveAttribute('aria-describedby');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -62,7 +62,7 @@ describe('Masthead', () => {
|
|
|
62
62
|
'insetXl',
|
|
63
63
|
'inset2xl',
|
|
64
64
|
'inset3xl'
|
|
65
|
-
]).forEach(inset => {
|
|
65
|
+
]).forEach((inset) => {
|
|
66
66
|
test(`verify ${inset} inset breakpoints`, () => {
|
|
67
67
|
const { asFragment } = render(
|
|
68
68
|
<Masthead inset={{ default: inset, sm: inset, md: inset, lg: inset, xl: inset, '2xl': inset }}>test</Masthead>
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import '@testing-library/jest-dom';
|
|
5
|
-
import userEvent from '@testing-library/user-event';
|
|
6
5
|
|
|
7
6
|
import { Menu } from '../Menu';
|
|
8
7
|
import { MenuItem } from '../MenuItem';
|
|
@@ -54,7 +53,7 @@ describe('Menu', () => {
|
|
|
54
53
|
|
|
55
54
|
describe('with hasCheckbox', () => {
|
|
56
55
|
test('should render Menu with checkbox items', () => {
|
|
57
|
-
|
|
56
|
+
render(
|
|
58
57
|
<Menu>
|
|
59
58
|
<MenuContent>
|
|
60
59
|
<MenuList>
|
|
@@ -67,7 +66,7 @@ describe('Menu', () => {
|
|
|
67
66
|
);
|
|
68
67
|
const checkbox1 = screen.getAllByRole('checkbox')[0];
|
|
69
68
|
expect(checkbox1).not.toBeChecked();
|
|
70
|
-
expect(screen.getByText(
|
|
69
|
+
expect(screen.getByText('Checkbox 1')).toBeInTheDocument();
|
|
71
70
|
});
|
|
72
71
|
});
|
|
73
72
|
});
|
|
@@ -5,7 +5,7 @@ import { Badge } from '../../Badge';
|
|
|
5
5
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
6
6
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
7
7
|
import userEvent from '@testing-library/user-event';
|
|
8
|
-
import {
|
|
8
|
+
import { render, screen } from '@testing-library/react';
|
|
9
9
|
|
|
10
10
|
describe('menu toggle', () => {
|
|
11
11
|
test('renders successfully', () => {
|
|
@@ -61,21 +61,23 @@ describe('menu toggle', () => {
|
|
|
61
61
|
const mockClick = jest.fn();
|
|
62
62
|
const user = userEvent.setup();
|
|
63
63
|
|
|
64
|
-
render(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
render(
|
|
65
|
+
<MenuToggle
|
|
66
|
+
onClick={mockClick}
|
|
67
|
+
splitButtonOptions={{
|
|
68
|
+
items: [
|
|
69
|
+
<MenuToggleCheckbox
|
|
70
|
+
id="split-button-checkbox-with-text-disabled-example"
|
|
71
|
+
key="split-checkbox-with-text-disabled"
|
|
72
|
+
aria-label="Select all"
|
|
73
|
+
>
|
|
74
|
+
10 selected
|
|
75
|
+
</MenuToggleCheckbox>
|
|
76
|
+
]
|
|
77
|
+
}}
|
|
78
|
+
aria-label="Menu toggle with checkbox split button and text"
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
79
81
|
|
|
80
82
|
await user.click(screen.getByRole(`button`) as Element);
|
|
81
83
|
expect(mockClick).toHaveBeenCalled();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { MultipleFileUploadStatus } from '../MultipleFileUploadStatus';
|
|
4
4
|
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
|
|
5
5
|
|
|
@@ -48,7 +48,7 @@ describe('MultipleFileUploadStatusItem', () => {
|
|
|
48
48
|
fileName="testCustomFileName.txt"
|
|
49
49
|
fileSize={42}
|
|
50
50
|
progressId="test-progress-id"
|
|
51
|
-
progressAriaLiveMessage={loadPercentage => `test message ${loadPercentage}`}
|
|
51
|
+
progressAriaLiveMessage={(loadPercentage) => `test message ${loadPercentage}`}
|
|
52
52
|
/>
|
|
53
53
|
);
|
|
54
54
|
|
package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadTitleTextSeparator.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { MultipleFileUploadTitleTextSeparator } from '../MultipleFileUploadTitleTextSeparator';
|
|
4
4
|
|
|
5
5
|
describe('MultipleFileUploadTitleTextSeparator', () => {
|
|
@@ -30,7 +30,7 @@ describe('Nav', () => {
|
|
|
30
30
|
const { asFragment } = renderNav(
|
|
31
31
|
<Nav className="test-nav-class">
|
|
32
32
|
<NavList className="test-nav-list-class">
|
|
33
|
-
{props.items.map(item => (
|
|
33
|
+
{props.items.map((item) => (
|
|
34
34
|
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
35
35
|
{item.label}
|
|
36
36
|
</NavItem>
|
|
@@ -47,7 +47,7 @@ describe('Nav', () => {
|
|
|
47
47
|
<React.StrictMode>
|
|
48
48
|
<Nav className="test-nav-class">
|
|
49
49
|
<NavList className="test-nav-list-class">
|
|
50
|
-
{props.items.map(item => (
|
|
50
|
+
{props.items.map((item) => (
|
|
51
51
|
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
52
52
|
{item.label}
|
|
53
53
|
</NavItem>
|
|
@@ -64,7 +64,7 @@ describe('Nav', () => {
|
|
|
64
64
|
const { asFragment } = renderNav(
|
|
65
65
|
<Nav className="test=nav-class" theme="dark">
|
|
66
66
|
<NavList className="test-nav-list-class">
|
|
67
|
-
{props.items.map(item => (
|
|
67
|
+
{props.items.map((item) => (
|
|
68
68
|
<NavItem to={item.to} key={item.to} className="test-nav-item-class">
|
|
69
69
|
{item.label}
|
|
70
70
|
</NavItem>
|
|
@@ -81,7 +81,7 @@ describe('Nav', () => {
|
|
|
81
81
|
const { asFragment } = renderNav(
|
|
82
82
|
<Nav>
|
|
83
83
|
<NavList>
|
|
84
|
-
{props.items.map(item => (
|
|
84
|
+
{props.items.map((item) => (
|
|
85
85
|
<NavItem to={item.to} key={item.to}>
|
|
86
86
|
{item.label}
|
|
87
87
|
</NavItem>
|
|
@@ -99,7 +99,7 @@ describe('Nav', () => {
|
|
|
99
99
|
<Nav>
|
|
100
100
|
<NavList>
|
|
101
101
|
<NavExpandable id="grp-1" title="Section 1">
|
|
102
|
-
{props.items.map(item => (
|
|
102
|
+
{props.items.map((item) => (
|
|
103
103
|
<NavItem to={item.to} key={item.to}>
|
|
104
104
|
{item.label}
|
|
105
105
|
</NavItem>
|
|
@@ -119,7 +119,7 @@ describe('Nav', () => {
|
|
|
119
119
|
<Nav>
|
|
120
120
|
<NavList>
|
|
121
121
|
<NavExpandable id="grp-1" title="Section 1" onExpand={onExpand}>
|
|
122
|
-
{props.items.map(item => (
|
|
122
|
+
{props.items.map((item) => (
|
|
123
123
|
<NavItem to={item.to} key={item.to}>
|
|
124
124
|
{item.label}
|
|
125
125
|
</NavItem>
|
|
@@ -141,7 +141,7 @@ describe('Nav', () => {
|
|
|
141
141
|
<Nav>
|
|
142
142
|
<NavList>
|
|
143
143
|
<NavExpandable id="grp-1" title="Section 1" className="expandable-group" isExpanded>
|
|
144
|
-
{props.items.map(item => (
|
|
144
|
+
{props.items.map((item) => (
|
|
145
145
|
<NavItem to={item.to} key={item.to}>
|
|
146
146
|
{item.label}
|
|
147
147
|
</NavItem>
|
|
@@ -160,7 +160,7 @@ describe('Nav', () => {
|
|
|
160
160
|
<Nav aria-label="Test">
|
|
161
161
|
<NavList>
|
|
162
162
|
<NavExpandable id="grp-1" title="Section 1" srText="Section 1 - Example sub-navigation">
|
|
163
|
-
{props.items.map(item => (
|
|
163
|
+
{props.items.map((item) => (
|
|
164
164
|
<NavItem to={item.to} key={item.to}>
|
|
165
165
|
{item.label}
|
|
166
166
|
</NavItem>
|
|
@@ -177,7 +177,7 @@ describe('Nav', () => {
|
|
|
177
177
|
<Nav>
|
|
178
178
|
<NavGroup id="grp-1" title="Section 1">
|
|
179
179
|
<NavList>
|
|
180
|
-
{props.items.map(item => (
|
|
180
|
+
{props.items.map((item) => (
|
|
181
181
|
<NavItem to={item.to} key={`section1_${item.to}`}>
|
|
182
182
|
{item.label}
|
|
183
183
|
</NavItem>
|
|
@@ -186,7 +186,7 @@ describe('Nav', () => {
|
|
|
186
186
|
</NavGroup>
|
|
187
187
|
<NavGroup id="grp-2" title="Section 2">
|
|
188
188
|
<NavList>
|
|
189
|
-
{props.items.map(item => (
|
|
189
|
+
{props.items.map((item) => (
|
|
190
190
|
<NavItem to={item.to} key={`section2_${item.to}`}>
|
|
191
191
|
{item.label}
|
|
192
192
|
</NavItem>
|
|
@@ -202,7 +202,7 @@ describe('Nav', () => {
|
|
|
202
202
|
const { asFragment } = renderNav(
|
|
203
203
|
<Nav variant="horizontal">
|
|
204
204
|
<NavList>
|
|
205
|
-
{props.items.map(item => (
|
|
205
|
+
{props.items.map((item) => (
|
|
206
206
|
<NavItem to={item.to} key={item.to}>
|
|
207
207
|
{item.label}
|
|
208
208
|
</NavItem>
|
|
@@ -217,7 +217,7 @@ describe('Nav', () => {
|
|
|
217
217
|
const { asFragment } = renderNav(
|
|
218
218
|
<Nav variant="horizontal-subnav">
|
|
219
219
|
<NavList>
|
|
220
|
-
{props.items.map(item => (
|
|
220
|
+
{props.items.map((item) => (
|
|
221
221
|
<NavItem to={item.to} key={item.to}>
|
|
222
222
|
{item.label}
|
|
223
223
|
</NavItem>
|
|
@@ -232,7 +232,7 @@ describe('Nav', () => {
|
|
|
232
232
|
const { asFragment } = renderNav(
|
|
233
233
|
<Nav variant="tertiary">
|
|
234
234
|
<NavList>
|
|
235
|
-
{props.items.map(item => (
|
|
235
|
+
{props.items.map((item) => (
|
|
236
236
|
<NavItem to={item.to} key={item.to}>
|
|
237
237
|
{item.label}
|
|
238
238
|
</NavItem>
|
|
@@ -269,7 +269,7 @@ describe('Nav', () => {
|
|
|
269
269
|
</Nav>
|
|
270
270
|
);
|
|
271
271
|
|
|
272
|
-
await user.hover(screen.getByText('My custom node'))
|
|
272
|
+
await user.hover(screen.getByText('My custom node'));
|
|
273
273
|
expect(asFragment()).toMatchSnapshot();
|
|
274
274
|
});
|
|
275
275
|
});
|
|
@@ -22,7 +22,7 @@ export const NavFlyout: React.FunctionComponent = () => {
|
|
|
22
22
|
<MenuItem onClick={onMenuItemClick} flyoutMenu={children} itemId={`nav-flyout-next-menu-${depth}`}>
|
|
23
23
|
Next menu
|
|
24
24
|
</MenuItem>
|
|
25
|
-
{Array.
|
|
25
|
+
{Array.from({ length: numFlyouts - depth }).map((_value, index) => (
|
|
26
26
|
<MenuItem
|
|
27
27
|
onClick={onMenuItemClick}
|
|
28
28
|
key={`${depth}-${index}`}
|
|
@@ -11,7 +11,7 @@ export const NavHorizontalSubNav: React.FunctionComponent = () => {
|
|
|
11
11
|
return (
|
|
12
12
|
<Nav onSelect={onSelect} variant="horizontal-subnav" aria-label="Horizontal subnav local">
|
|
13
13
|
<NavList>
|
|
14
|
-
{Array.
|
|
14
|
+
{Array.from({ length: 10 }).map((_value, index) => {
|
|
15
15
|
const num = index + 1;
|
|
16
16
|
return (
|
|
17
17
|
<NavItem
|
|
@@ -11,7 +11,7 @@ export const NavLegacyTertiary: React.FunctionComponent = () => {
|
|
|
11
11
|
return (
|
|
12
12
|
<Nav onSelect={onSelect} variant="tertiary" aria-label="Tertiary local">
|
|
13
13
|
<NavList>
|
|
14
|
-
{Array.
|
|
14
|
+
{Array.from({ length: 10 }).map(function (_value, index) {
|
|
15
15
|
const num = index + 1;
|
|
16
16
|
return (
|
|
17
17
|
<NavItem
|
|
@@ -2,7 +2,7 @@ import { NotificationBadge } from '../NotificationBadge';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
|
|
5
|
-
Object.values([true, false]).forEach(attentionVariant => {
|
|
5
|
+
Object.values([true, false]).forEach((attentionVariant) => {
|
|
6
6
|
test(`${attentionVariant} NotificationBadge needs attention`, () => {
|
|
7
7
|
const { asFragment } = render(
|
|
8
8
|
<NotificationBadge variant="attention">
|
|
@@ -12,7 +12,9 @@ describe('NotificationDrawerGroup', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
test('renders correct heading level', () => {
|
|
15
|
-
const { asFragment } = render(
|
|
15
|
+
const { asFragment } = render(
|
|
16
|
+
<NotificationDrawerGroup count={2} isExpanded={false} title="Critical Alerts" headingLevel="h2" />
|
|
17
|
+
);
|
|
16
18
|
expect(asFragment()).toMatchSnapshot();
|
|
17
19
|
});
|
|
18
20
|
|
|
@@ -25,7 +25,6 @@ describe('NotificationDrawerListItem', () => {
|
|
|
25
25
|
render(<NotificationDrawerListItem isRead />);
|
|
26
26
|
expect(screen.getByRole('listitem')).toHaveClass('pf-m-read');
|
|
27
27
|
expect(screen.getByRole('listitem')).toContainHTML('<span class="pf-v5-screen-reader">read</span>');
|
|
28
|
-
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
test('drawer list item has screen reader text set to unread by default', () => {
|
|
@@ -34,8 +33,7 @@ describe('NotificationDrawerListItem', () => {
|
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
test('drawer list item screen reader textcan be customized', () => {
|
|
37
|
-
render(<NotificationDrawerListItem readStateScreenReaderText="was read"/>);
|
|
36
|
+
render(<NotificationDrawerListItem readStateScreenReaderText="was read" />);
|
|
38
37
|
expect(screen.getByRole('listitem')).toContainHTML('<span class="pf-v5-screen-reader">was read</span>');
|
|
39
38
|
});
|
|
40
39
|
});
|
|
41
|
-
|
package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemHeader.test.tsx
CHANGED
|
@@ -13,7 +13,7 @@ describe('NotificationDrawerListItemHeader', () => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
test('renders with correct heading level', () => {
|
|
16
|
-
const { asFragment } = render(<NotificationDrawerListItemHeader title="Pod quit unexpectedly" headingLevel="h3"/>);
|
|
16
|
+
const { asFragment } = render(<NotificationDrawerListItemHeader title="Pod quit unexpectedly" headingLevel="h3" />);
|
|
17
17
|
expect(asFragment()).toMatchSnapshot();
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -212,13 +212,13 @@ describe('numberInput', () => {
|
|
|
212
212
|
expect(input).toHaveDisplayValue('');
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
-
test('does not throw an error if onChange is passed via inputProps as well as the onChange prop', () => {
|
|
215
|
+
test('does not throw an error if onChange is passed via inputProps as well as the onChange prop', async () => {
|
|
216
216
|
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
217
217
|
|
|
218
218
|
const NumberInputWrapper = () => {
|
|
219
219
|
const [value, setValue] = React.useState(0);
|
|
220
|
-
const onChange = event => setValue(event.currentTarget.value);
|
|
221
|
-
const inputProps = { onChange
|
|
220
|
+
const onChange = (event) => setValue(event.currentTarget.value);
|
|
221
|
+
const inputProps = { onChange };
|
|
222
222
|
|
|
223
223
|
return <NumberInput value={value} onChange={onChange} inputProps={{ ...inputProps }} />;
|
|
224
224
|
};
|
|
@@ -226,20 +226,20 @@ describe('numberInput', () => {
|
|
|
226
226
|
render(<NumberInputWrapper />);
|
|
227
227
|
|
|
228
228
|
const input = screen.getByRole('spinbutton');
|
|
229
|
-
userEvent.type(input, '0');
|
|
229
|
+
await userEvent.type(input, '0');
|
|
230
230
|
|
|
231
231
|
expect(consoleSpy).not.toHaveBeenCalled();
|
|
232
232
|
});
|
|
233
233
|
|
|
234
234
|
test('input is read only if onChange not passed ', () => {
|
|
235
|
-
render(<NumberInput inputAriaLabel="readonly input" value={5}/>);
|
|
235
|
+
render(<NumberInput inputAriaLabel="readonly input" value={5} />);
|
|
236
236
|
const input = screen.getByLabelText('readonly input');
|
|
237
237
|
expect(input).toHaveAttribute('readOnly');
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
test('input is not read only if onChange passed ', () => {
|
|
241
241
|
const onChangeMock = jest.fn();
|
|
242
|
-
render(<NumberInput inputAriaLabel="not readonly input" value={5} onChange={onChangeMock}/>);
|
|
242
|
+
render(<NumberInput inputAriaLabel="not readonly input" value={5} onChange={onChangeMock} />);
|
|
243
243
|
const input = screen.getByLabelText('not readonly input');
|
|
244
244
|
expect(input).not.toHaveAttribute('readOnly');
|
|
245
245
|
});
|
|
@@ -340,10 +340,12 @@ describe('Pagination', () => {
|
|
|
340
340
|
'insetLg',
|
|
341
341
|
'insetXl',
|
|
342
342
|
'inset2xl'
|
|
343
|
-
]).forEach(inset => {
|
|
343
|
+
]).forEach((inset) => {
|
|
344
344
|
test(`verify ${inset} inset breakpoints`, () => {
|
|
345
345
|
const { asFragment } = render(
|
|
346
|
-
<Pagination inset={{ default: inset, sm: inset, md: inset, lg: inset, xl: inset, '2xl': inset }}>
|
|
346
|
+
<Pagination inset={{ default: inset, sm: inset, md: inset, lg: inset, xl: inset, '2xl': inset }}>
|
|
347
|
+
test
|
|
348
|
+
</Pagination>
|
|
347
349
|
);
|
|
348
350
|
expect(asFragment()).toMatchSnapshot();
|
|
349
351
|
});
|
|
@@ -27,8 +27,8 @@ export const PaginationSticky: React.FunctionComponent = () => {
|
|
|
27
27
|
const buildCards = () => {
|
|
28
28
|
const numberOfCards = (page - 1) * perPage + perPage - 1 >= itemCount ? itemCount - (page - 1) * perPage : perPage;
|
|
29
29
|
|
|
30
|
-
return Array.
|
|
31
|
-
<GalleryItem key={
|
|
30
|
+
return Array.from({ length: numberOfCards }).map((_value, index) => (
|
|
31
|
+
<GalleryItem key={index}>
|
|
32
32
|
<Card>
|
|
33
33
|
<CardBody>This is a card</CardBody>
|
|
34
34
|
</Card>
|
|
@@ -85,9 +85,9 @@ test('Renders with ref', async () => {
|
|
|
85
85
|
render(<BasicPanel />);
|
|
86
86
|
|
|
87
87
|
await user.click(document.body);
|
|
88
|
-
expect(screen.getByText('Last click was in panel: false')).toBeVisible;
|
|
88
|
+
expect(screen.getByText('Last click was in panel: false')).toBeVisible();
|
|
89
89
|
await user.click(screen.getByText('Main content'));
|
|
90
|
-
expect(screen.getByText('Last click was in panel: true')).toBeVisible;
|
|
90
|
+
expect(screen.getByText('Last click was in panel: true')).toBeVisible();
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
test('Renders with the inherited element props spread to the component', () => {
|