@patternfly/react-core 5.2.0-prerelease.29 → 5.2.0-prerelease.30
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 +6 -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/Chip/Chip.d.ts +1 -0
- package/dist/esm/components/Chip/Chip.d.ts.map +1 -1
- package/dist/esm/components/Chip/Chip.js +8 -0
- package/dist/esm/components/Chip/Chip.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +5 -5
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.d.ts +0 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
- package/dist/esm/components/DataList/DataList.d.ts.map +1 -1
- package/dist/esm/components/DataList/DataList.js +2 -2
- package/dist/esm/components/DataList/DataList.js.map +1 -1
- package/dist/esm/components/DataList/DataListAction.js +3 -3
- package/dist/esm/components/DataList/DataListAction.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Chip/Chip.d.ts +1 -0
- package/dist/js/components/Chip/Chip.d.ts.map +1 -1
- package/dist/js/components/Chip/Chip.js +8 -0
- package/dist/js/components/Chip/Chip.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +5 -5
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.d.ts +0 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
- package/dist/js/components/DataList/DataList.d.ts.map +1 -1
- package/dist/js/components/DataList/DataList.js +2 -2
- package/dist/js/components/DataList/DataList.js.map +1 -1
- package/dist/js/components/DataList/DataListAction.js +3 -3
- package/dist/js/components/DataList/DataListAction.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +1 -1
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Chip/Chip.tsx +11 -0
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +5 -5
- package/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx +0 -1
- package/src/components/DataList/DataList.tsx +2 -0
- package/src/components/DataList/DataListAction.tsx +1 -1
- package/src/components/DataList/__tests__/DataList.test.tsx +140 -304
- package/src/components/DataList/__tests__/DataListAction.test.tsx +75 -0
- package/src/components/DataList/__tests__/DataListCell.test.tsx +120 -0
- package/src/components/DataList/__tests__/DataListCheck.test.tsx +5 -0
- package/src/components/DataList/__tests__/DataListContent.test.tsx +73 -0
- package/src/components/DataList/__tests__/DataListItem.test.tsx +46 -0
- package/src/components/DataList/__tests__/DataListItemCells.test.tsx +25 -0
- package/src/components/DataList/__tests__/DataListItemRow.test.tsx +44 -0
- package/src/components/DataList/__tests__/DataListToggle.test.tsx +61 -0
- package/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +2 -323
- package/src/components/DataList/__tests__/__snapshots__/DataListAction.test.tsx.snap +11 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListCell.test.tsx.snap +11 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListContent.test.tsx.snap +17 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListItem.test.tsx.snap +11 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListItemCells.test.tsx.snap +9 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListItemRow.test.tsx.snap +9 -0
- package/src/components/DataList/__tests__/__snapshots__/DataListToggle.test.tsx.snap +45 -0
- package/src/components/DataList/examples/DataListCheckboxes.tsx +5 -5
- package/src/components/DataList/examples/DataListMixedExpandable.tsx +1 -1
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +2 -2
- package/src/components/DescriptionList/__tests__/DescriptionList.test.tsx +128 -102
- package/src/components/DescriptionList/__tests__/DescriptionListDescription.test.tsx +25 -0
- package/src/components/DescriptionList/__tests__/DescriptionListGroup.test.tsx +25 -0
- package/src/components/DescriptionList/__tests__/DescriptionListHelpTextButton.test.tsx +27 -0
- package/src/components/DescriptionList/__tests__/DescriptionListTerm.test.tsx +35 -0
- package/src/components/DescriptionList/__tests__/DescriptionListTermHelpText.test.tsx +25 -0
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionList.test.tsx.snap +1 -157
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListDescription.test.tsx.snap +15 -0
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListGroup.test.tsx.snap +11 -0
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListHelpTextButton.test.tsx.snap +14 -0
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListTerm.test.tsx.snap +15 -0
- package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListTermHelpText.test.tsx.snap +11 -0
- package/src/components/HelperText/__tests__/HelperText.test.tsx +67 -57
- package/src/components/HelperText/__tests__/HelperTextItem.test.tsx +93 -0
- package/src/components/HelperText/__tests__/__snapshots__/HelperText.test.tsx.snap +2 -223
- package/src/components/HelperText/__tests__/__snapshots__/HelperTextItem.test.tsx.snap +15 -0
- package/src/demos/CustomMenus/CustomMenus.md +6 -0
- package/src/demos/CustomMenus/examples/InlineSearchFilterMenuDemo.tsx +102 -0
- package/src/demos/SearchInput/SearchInput.md +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListAction } from '../DataListAction';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(
|
|
9
|
+
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action">
|
|
10
|
+
test
|
|
11
|
+
</DataListAction>
|
|
12
|
+
);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test(`Renders with default class ${styles.dataListItemAction}`, () => {
|
|
17
|
+
render(
|
|
18
|
+
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action">
|
|
19
|
+
test
|
|
20
|
+
</DataListAction>
|
|
21
|
+
);
|
|
22
|
+
expect(screen.getByText('test')).toHaveClass(styles.dataListItemAction, { exact: true });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
26
|
+
render(
|
|
27
|
+
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action" className="test-class">
|
|
28
|
+
test
|
|
29
|
+
</DataListAction>
|
|
30
|
+
);
|
|
31
|
+
expect(screen.getByText('test')).toHaveClass('test-class');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test(`Renders with spread props`, () => {
|
|
35
|
+
render(
|
|
36
|
+
<DataListAction dir="rtl" aria-label="Actions" aria-labelledby="ex-action" id="ex-action">
|
|
37
|
+
test
|
|
38
|
+
</DataListAction>
|
|
39
|
+
);
|
|
40
|
+
expect(screen.getByText('test')).toHaveAttribute('dir', 'rtl');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test(`Renders with class ${styles.dataListAction} when isPlainButtonAction = true`, () => {
|
|
44
|
+
render(
|
|
45
|
+
<DataListAction id="id" aria-label="Actions" aria-labelledby="ex-action" isPlainButtonAction>
|
|
46
|
+
test
|
|
47
|
+
</DataListAction>
|
|
48
|
+
);
|
|
49
|
+
expect(screen.getByText('test')).toHaveClass(styles.dataListAction);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
['hidden', 'visible'].forEach((vis) => {
|
|
53
|
+
const visMod = vis as 'hidden' | 'visible';
|
|
54
|
+
test(`Has visibility - ${vis} for every breakpoint`, () => {
|
|
55
|
+
render(
|
|
56
|
+
<DataListAction
|
|
57
|
+
visibility={{ default: visMod, sm: visMod, md: visMod, lg: visMod, xl: visMod, '2xl': visMod }}
|
|
58
|
+
aria-labelledby="check-action-item2 check-action-action2"
|
|
59
|
+
id="check-action-action2"
|
|
60
|
+
aria-label="Actions"
|
|
61
|
+
>
|
|
62
|
+
test
|
|
63
|
+
</DataListAction>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (visMod === 'hidden') {
|
|
67
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}`]);
|
|
68
|
+
}
|
|
69
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}OnSm`]);
|
|
70
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}OnMd`]);
|
|
71
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}OnLg`]);
|
|
72
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}OnXl`]);
|
|
73
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers[`${visMod}On_2xl`]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListCell } from '../DataListCell';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Cell renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(<DataListCell>Secondary</DataListCell>);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Renders default class ${styles.dataListCell}`, () => {
|
|
13
|
+
render(
|
|
14
|
+
<DataListCell data-testid="test" key={0}>
|
|
15
|
+
Primary Id
|
|
16
|
+
</DataListCell>
|
|
17
|
+
);
|
|
18
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.dataListCell, { exact: true });
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test(`Renders custom class when className is passed`, () => {
|
|
22
|
+
render(
|
|
23
|
+
<DataListCell data-testid="test" key={0} className="test-class">
|
|
24
|
+
Primary Id
|
|
25
|
+
</DataListCell>
|
|
26
|
+
);
|
|
27
|
+
expect(screen.getByTestId('test')).toHaveClass('test-class');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test(`Renders with spread props`, () => {
|
|
31
|
+
render(
|
|
32
|
+
<DataListCell key={0} id="test">
|
|
33
|
+
Primary Id
|
|
34
|
+
</DataListCell>
|
|
35
|
+
);
|
|
36
|
+
expect(screen.getByText('Primary Id')).toHaveAttribute('id', 'test');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders width modifier when width is passed', () => {
|
|
40
|
+
[
|
|
41
|
+
{ width: 1, class: '' },
|
|
42
|
+
{ width: 2, class: styles.modifiers.flex_2 },
|
|
43
|
+
{ width: 3, class: styles.modifiers.flex_3 },
|
|
44
|
+
{ width: 4, class: styles.modifiers.flex_4 },
|
|
45
|
+
{ width: 5, class: styles.modifiers.flex_5 }
|
|
46
|
+
].forEach((testCase, index) => {
|
|
47
|
+
const testId = `cell-test-id-${index}`;
|
|
48
|
+
|
|
49
|
+
render(
|
|
50
|
+
<DataListCell data-testid={testId} width={testCase.width as any} key={index}>
|
|
51
|
+
Primary Id
|
|
52
|
+
</DataListCell>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const dataListCell = screen.getByTestId(testId);
|
|
56
|
+
|
|
57
|
+
testCase.class === ''
|
|
58
|
+
? expect(dataListCell).not.toHaveClass(
|
|
59
|
+
styles.modifiers.flex_2,
|
|
60
|
+
styles.modifiers.flex_3,
|
|
61
|
+
styles.modifiers.flex_4,
|
|
62
|
+
styles.modifiers.flex_5
|
|
63
|
+
)
|
|
64
|
+
: expect(dataListCell).toHaveClass(`pf-v5-c-data-list__cell ${testCase.class}`, { exact: true });
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('Has text wrap modifiers when wrapModifier is passed', () => {
|
|
69
|
+
[
|
|
70
|
+
{ wrapModifier: null as any, class: '' },
|
|
71
|
+
{ wrapModifier: 'breakWord', class: styles.modifiers.breakWord },
|
|
72
|
+
{ wrapModifier: 'nowrap', class: styles.modifiers.nowrap },
|
|
73
|
+
{ wrapModifier: 'truncate', class: styles.modifiers.truncate }
|
|
74
|
+
].forEach((testCase, index) => {
|
|
75
|
+
const testId = `cell-test-id-${index}`;
|
|
76
|
+
|
|
77
|
+
render(
|
|
78
|
+
<DataListCell data-testid={testId} wrapModifier={testCase.wrapModifier} key={index}>
|
|
79
|
+
Primary Id
|
|
80
|
+
</DataListCell>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const dataListCell = screen.getByTestId(testId);
|
|
84
|
+
|
|
85
|
+
testCase.class === ''
|
|
86
|
+
? expect(dataListCell).not.toHaveClass(
|
|
87
|
+
styles.modifiers.breakWord,
|
|
88
|
+
styles.modifiers.nowrap,
|
|
89
|
+
styles.modifiers.truncate
|
|
90
|
+
)
|
|
91
|
+
: expect(dataListCell).toHaveClass(`${testCase.class}`);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test(`Renders with class ${styles.modifiers.alignRight} when alignRight is passed`, () => {
|
|
96
|
+
render(
|
|
97
|
+
<DataListCell data-testid="test" key={0} alignRight>
|
|
98
|
+
Primary Id
|
|
99
|
+
</DataListCell>
|
|
100
|
+
);
|
|
101
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.modifiers.alignRight);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test(`Renders with class ${styles.modifiers.icon} when isIcon is passed`, () => {
|
|
105
|
+
render(
|
|
106
|
+
<DataListCell data-testid="test" key={0} isIcon>
|
|
107
|
+
Primary Id
|
|
108
|
+
</DataListCell>
|
|
109
|
+
);
|
|
110
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.modifiers.icon);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test(`Renders with class ${styles.modifiers.noFill} when isFilled = false`, () => {
|
|
114
|
+
render(
|
|
115
|
+
<DataListCell data-testid="test" key={0} isFilled={false}>
|
|
116
|
+
Primary Id
|
|
117
|
+
</DataListCell>
|
|
118
|
+
);
|
|
119
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.modifiers.noFill);
|
|
120
|
+
});
|
|
@@ -3,6 +3,11 @@ import { render, screen } from '@testing-library/react';
|
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { DataListCheck } from '../DataListCheck';
|
|
5
5
|
|
|
6
|
+
test(`Renders with spread props`, () => {
|
|
7
|
+
render(<DataListCheck id="test" aria-labelledby={'string'} isChecked />);
|
|
8
|
+
expect(screen.getByRole('checkbox')).toHaveAttribute('id', 'test');
|
|
9
|
+
});
|
|
10
|
+
|
|
6
11
|
it('does not throw a "A component is changing an uncontrolled input of type checkbox to be controlled" error when changed if using isChecked', async () => {
|
|
7
12
|
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
8
13
|
const user = userEvent.setup();
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListContent } from '../DataListContent';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(<DataListContent aria-label="Primary Content Details"> test</DataListContent>);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Renders with default class ${styles.dataListExpandableContent}`, () => {
|
|
13
|
+
render(
|
|
14
|
+
<DataListContent data-testid="test-id" aria-label="Primary Content Details">
|
|
15
|
+
test
|
|
16
|
+
</DataListContent>
|
|
17
|
+
);
|
|
18
|
+
expect(screen.getByTestId('test-id')).toHaveClass(styles.dataListExpandableContent, { exact: true });
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test(`Renders with default class ${styles.dataListExpandableContentBody}`, () => {
|
|
22
|
+
render(
|
|
23
|
+
<DataListContent data-testid="test-id" aria-label="Primary Content Details">
|
|
24
|
+
test
|
|
25
|
+
</DataListContent>
|
|
26
|
+
);
|
|
27
|
+
expect(screen.getByText('test')).toHaveClass(styles.dataListExpandableContentBody, { exact: true });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
31
|
+
render(
|
|
32
|
+
<DataListContent data-testid="test-id" aria-label="Primary Content Details" className="test-class">
|
|
33
|
+
test
|
|
34
|
+
</DataListContent>
|
|
35
|
+
);
|
|
36
|
+
expect(screen.getByTestId('test-id')).toHaveClass('test-class');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test(`Renders with id when id is passed`, () => {
|
|
40
|
+
render(
|
|
41
|
+
<DataListContent id="idProp" data-testid="test-id" aria-label="Primary Content Details" className="test-class">
|
|
42
|
+
test
|
|
43
|
+
</DataListContent>
|
|
44
|
+
);
|
|
45
|
+
expect(screen.getByTestId('test-id')).toHaveAttribute('id', 'idProp');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test(`Renders with spread props`, () => {
|
|
49
|
+
render(
|
|
50
|
+
<DataListContent dir="rtl" data-testid="test-id" aria-label="Primary Content Details">
|
|
51
|
+
test
|
|
52
|
+
</DataListContent>
|
|
53
|
+
);
|
|
54
|
+
expect(screen.getByTestId('test-id')).toHaveAttribute('dir', 'rtl');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test(`Renders with class ${styles.modifiers.noPadding} when hasNoPadding is passed`, () => {
|
|
58
|
+
render(
|
|
59
|
+
<DataListContent aria-label="Primary Content Details" hidden hasNoPadding>
|
|
60
|
+
test
|
|
61
|
+
</DataListContent>
|
|
62
|
+
);
|
|
63
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers.noPadding);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test(`Renders with hidden property when isHidden is passed`, () => {
|
|
67
|
+
render(
|
|
68
|
+
<DataListContent data-testid="test-id" aria-label="Primary Content Details" isHidden>
|
|
69
|
+
test
|
|
70
|
+
</DataListContent>
|
|
71
|
+
);
|
|
72
|
+
expect(screen.getByTestId('test-id')).toHaveAttribute('hidden');
|
|
73
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListItem } from '../DataListItem';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(
|
|
9
|
+
<DataListItem key="item-id-1" aria-labelledby="item-1">
|
|
10
|
+
test
|
|
11
|
+
</DataListItem>
|
|
12
|
+
);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test(`Renders with default class ${styles.dataListItem}`, () => {
|
|
17
|
+
render(<DataListItem aria-labelledby="item-1">test</DataListItem>);
|
|
18
|
+
expect(screen.getByRole('listitem')).toHaveClass(styles.dataListItem, { exact: true });
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Renders with custom class name', () => {
|
|
22
|
+
render(
|
|
23
|
+
<DataListItem className="data-list-item-custom" aria-labelledby="item-1">
|
|
24
|
+
test
|
|
25
|
+
</DataListItem>
|
|
26
|
+
);
|
|
27
|
+
expect(screen.getByRole('listitem')).toHaveClass('data-list-item-custom');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('Renders with spread props', () => {
|
|
31
|
+
render(
|
|
32
|
+
<DataListItem dir="rtl" aria-labelledby="item-1">
|
|
33
|
+
test
|
|
34
|
+
</DataListItem>
|
|
35
|
+
);
|
|
36
|
+
expect(screen.getByRole('listitem')).toHaveAttribute('dir', 'rtl');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test(`Renders class ${styles.modifiers.expanded} when isExpanded is passed`, () => {
|
|
40
|
+
render(
|
|
41
|
+
<DataListItem aria-labelledby="item-1" isExpanded>
|
|
42
|
+
test
|
|
43
|
+
</DataListItem>
|
|
44
|
+
);
|
|
45
|
+
expect(screen.getByRole('listitem')).toHaveClass(styles.modifiers.expanded);
|
|
46
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListItemCells } from '../DataListItemCells';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Cells renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(<DataListItemCells dataListCells={[]} />);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Renders with default class ${styles.dataListItemContent}`, () => {
|
|
13
|
+
render(<DataListItemCells dataListCells="test" />);
|
|
14
|
+
expect(screen.getByText('test')).toHaveClass(styles.dataListItemContent, { exact: true });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
18
|
+
render(<DataListItemCells className="custom" dataListCells="test" />);
|
|
19
|
+
expect(screen.getByText('test')).toHaveClass('custom');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test(`Renders with spread props`, () => {
|
|
23
|
+
render(<DataListItemCells dir="rtl" dataListCells="test" />);
|
|
24
|
+
expect(screen.getByText('test')).toHaveAttribute('dir', 'rtl');
|
|
25
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListItemRow } from '../DataListItemRow';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Item row renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(<DataListItemRow>test</DataListItemRow>);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Renders with default class ${styles.dataListItemRow}`, () => {
|
|
13
|
+
render(<DataListItemRow data-testid="test">test</DataListItemRow>);
|
|
14
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.dataListItemRow, { exact: true });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
18
|
+
render(
|
|
19
|
+
<DataListItemRow className="custom" data-testid="test">
|
|
20
|
+
test
|
|
21
|
+
</DataListItemRow>
|
|
22
|
+
);
|
|
23
|
+
expect(screen.getByTestId('test')).toHaveClass('custom');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test(`Renders with spread props`, () => {
|
|
27
|
+
render(
|
|
28
|
+
<DataListItemRow dir="rtl" data-testid="test">
|
|
29
|
+
test
|
|
30
|
+
</DataListItemRow>
|
|
31
|
+
);
|
|
32
|
+
expect(screen.getByTestId('test')).toHaveAttribute('dir', 'rtl');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
['nowrap', 'truncate', 'breakWord'].forEach((wrap) => {
|
|
36
|
+
test(`Renders with class ${styles.modifiers[wrap]} when wrapModifier = ${wrap} is pased`, () => {
|
|
37
|
+
render(
|
|
38
|
+
<DataListItemRow data-testid="test" wrapModifier={wrap as 'nowrap' | 'truncate' | 'breakWord'}>
|
|
39
|
+
test
|
|
40
|
+
</DataListItemRow>
|
|
41
|
+
);
|
|
42
|
+
expect(screen.getByTestId('test')).toHaveClass(styles.modifiers[wrap]);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DataListToggle } from '../DataListToggle';
|
|
4
|
+
|
|
5
|
+
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
6
|
+
|
|
7
|
+
test('Renders to match snapshot', () => {
|
|
8
|
+
const { asFragment } = render(<DataListToggle id="ex-toggle2" />);
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Renders with default class ${styles.dataListToggle}`, () => {
|
|
13
|
+
render(<DataListToggle id="ex-toggle2" />);
|
|
14
|
+
expect(screen.getByRole('button').parentElement).toHaveClass(styles.dataListToggle);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test(`Renders with default class ${styles.dataListItemControl}`, () => {
|
|
18
|
+
render(<DataListToggle id="ex-toggle2" />);
|
|
19
|
+
expect(screen.getByRole('button').parentElement?.parentElement).toHaveClass(styles.dataListItemControl, {
|
|
20
|
+
exact: true
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
25
|
+
render(<DataListToggle className="custom" id="ex-toggle2" />);
|
|
26
|
+
expect(screen.getByRole('button').parentElement?.parentElement).toHaveClass('custom');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test(`Renders with spread props`, () => {
|
|
30
|
+
render(<DataListToggle dir="rtl" id="ex-toggle2" />);
|
|
31
|
+
expect(screen.getByRole('button').parentElement?.parentElement).toHaveAttribute('dir', 'rtl');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test(`Renders with spread buttonProps`, () => {
|
|
35
|
+
render(<DataListToggle buttonProps={{ isDisabled: true }} id="ex-toggle2" />);
|
|
36
|
+
expect(screen.getByRole('button')).toHaveAttribute('disabled');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders aria-labelledby by default when no custom aria-label is passed', () => {
|
|
40
|
+
render(<DataListToggle rowid="row" id="ex-toggle2" />);
|
|
41
|
+
|
|
42
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-labelledby', 'row ex-toggle2');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('Does not render aria-labelledby when custom aria-label is passed', () => {
|
|
46
|
+
render(<DataListToggle aria-label="Toggle details for" id="ex-toggle2" />);
|
|
47
|
+
|
|
48
|
+
expect(screen.getByRole('button')).not.toHaveAttribute('aria-labelledby');
|
|
49
|
+
expect(screen.getByRole('button')).toHaveAccessibleName('Toggle details for');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test(`Renders with ariaControls when ariaControls is passed`, () => {
|
|
53
|
+
render(<DataListToggle aria-controls="control" id="ex-toggle2" />);
|
|
54
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-controls', 'control');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('Renders with aria-expanded when isExpanded = true', () => {
|
|
58
|
+
render(<DataListToggle isExpanded id="ex-toggle2" />);
|
|
59
|
+
|
|
60
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
|
|
61
|
+
});
|