@patternfly/react-core 6.2.1-prerelease.8 → 6.2.1-prerelease.9
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 +4 -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/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/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/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/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/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/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/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/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/styles/package.json +1 -1
- package/dist/esm/components/List/List.d.ts.map +1 -1
- package/dist/esm/components/List/List.js +2 -2
- package/dist/esm/components/List/List.js.map +1 -1
- package/dist/esm/components/List/ListItem.d.ts +4 -2
- package/dist/esm/components/List/ListItem.d.ts.map +1 -1
- package/dist/esm/components/List/ListItem.js +2 -2
- package/dist/esm/components/List/ListItem.js.map +1 -1
- package/dist/js/components/List/List.d.ts.map +1 -1
- package/dist/js/components/List/List.js +2 -2
- package/dist/js/components/List/List.js.map +1 -1
- package/dist/js/components/List/ListItem.d.ts +4 -2
- package/dist/js/components/List/ListItem.d.ts.map +1 -1
- package/dist/js/components/List/ListItem.js +2 -2
- package/dist/js/components/List/ListItem.js.map +1 -1
- package/dist/umd/assets/{output-f6wwe58y.css → output-Dz39wdRo.css} +17564 -17564
- 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/List/List.tsx +3 -0
- package/src/components/List/ListItem.tsx +7 -4
- package/src/components/List/__tests__/List.test.tsx +97 -101
- package/src/components/List/__tests__/ListItem.test.tsx +51 -0
- package/src/components/List/__tests__/__snapshots__/List.test.tsx.snap +4 -261
- package/src/components/List/__tests__/__snapshots__/ListItem.test.tsx.snap +34 -0
- package/src/components/List/__tests__/Generated/ListItem.test.tsx +0 -12
- package/src/components/List/__tests__/Generated/__snapshots__/ListItem.test.tsx.snap +0 -13
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.2.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.2.1-prerelease.8","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.2.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.2.1-prerelease.8","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.2.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.2.1-prerelease.8","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.2.1-prerelease.
|
|
3
|
+
"version": "6.2.1-prerelease.9",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "77cc1748f29487ca5cbcac4ebf00039479bc46f9"
|
|
67
67
|
}
|
|
@@ -49,12 +49,14 @@ export const List: React.FunctionComponent<ListProps> = ({
|
|
|
49
49
|
type = OrderType.number,
|
|
50
50
|
ref = null,
|
|
51
51
|
component = ListComponent.ul,
|
|
52
|
+
'aria-label': ariaLabel,
|
|
52
53
|
...props
|
|
53
54
|
}: ListProps) =>
|
|
54
55
|
component === ListComponent.ol ? (
|
|
55
56
|
<ol
|
|
56
57
|
ref={ref as React.Ref<HTMLOListElement>}
|
|
57
58
|
type={type}
|
|
59
|
+
aria-label={ariaLabel}
|
|
58
60
|
{...(isPlain && { role: 'list' })}
|
|
59
61
|
{...props}
|
|
60
62
|
className={css(
|
|
@@ -71,6 +73,7 @@ export const List: React.FunctionComponent<ListProps> = ({
|
|
|
71
73
|
) : (
|
|
72
74
|
<ul
|
|
73
75
|
ref={ref as React.Ref<HTMLUListElement>}
|
|
76
|
+
aria-label={ariaLabel}
|
|
74
77
|
{...(isPlain && { role: 'list' })}
|
|
75
78
|
{...props}
|
|
76
79
|
className={css(
|
|
@@ -2,18 +2,21 @@ import styles from '@patternfly/react-styles/css/components/List/list';
|
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
|
|
4
4
|
export interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/** Additional classes added to the list item */
|
|
6
|
+
className?: string;
|
|
7
7
|
/** Anything that can be rendered inside of list item */
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
+
/** Icon for the list item */
|
|
10
|
+
icon?: React.ReactNode | null;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export const ListItem: React.FunctionComponent<ListItemProps> = ({
|
|
12
|
-
|
|
14
|
+
className,
|
|
13
15
|
children = null,
|
|
16
|
+
icon = null,
|
|
14
17
|
...props
|
|
15
18
|
}: ListItemProps) => (
|
|
16
|
-
<li className={css(icon && styles.listItem)} {...props}>
|
|
19
|
+
<li className={css(icon && styles.listItem, className)} {...props}>
|
|
17
20
|
{icon && <span className={css(styles.listItemIcon)}>{icon}</span>}
|
|
18
21
|
<span className={icon && css(`${styles.list}__item-text`)}>{children}</span>
|
|
19
22
|
</li>
|
|
@@ -1,117 +1,113 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import BookOpen from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
4
|
-
import Key from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
5
|
-
import Desktop from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
6
2
|
import { List, ListVariant, ListComponent, OrderType } from '../List';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
const ListItems = () => (
|
|
10
|
-
<List>
|
|
11
|
-
<ListItem>First</ListItem>
|
|
12
|
-
<ListItem>Second</ListItem>
|
|
13
|
-
<ListItem>Third</ListItem>
|
|
14
|
-
</List>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
describe('List', () => {
|
|
18
|
-
test('simple list', () => {
|
|
19
|
-
const { asFragment } = render(
|
|
20
|
-
<List>
|
|
21
|
-
<ListItems />
|
|
22
|
-
</List>
|
|
23
|
-
);
|
|
24
|
-
expect(asFragment()).toMatchSnapshot();
|
|
25
|
-
});
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/List/list';
|
|
26
4
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</List>
|
|
32
|
-
);
|
|
33
|
-
expect(asFragment()).toMatchSnapshot();
|
|
34
|
-
});
|
|
5
|
+
describe('Shared tests between ol and ul lists', () => {
|
|
6
|
+
Object.values(ListComponent).forEach((component) => {
|
|
7
|
+
test(`Renders without children for ${component} list`, () => {
|
|
8
|
+
render(<List component={component}></List>);
|
|
35
9
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<List component={ListComponent.ol}>
|
|
39
|
-
<ListItem>Apple</ListItem>
|
|
40
|
-
<ListItem>Banana</ListItem>
|
|
41
|
-
<ListItem>Orange</ListItem>
|
|
42
|
-
</List>
|
|
43
|
-
);
|
|
44
|
-
expect(asFragment()).toMatchSnapshot();
|
|
45
|
-
});
|
|
10
|
+
expect(screen.getByRole('list')).toBeVisible();
|
|
11
|
+
});
|
|
46
12
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<List component={ListComponent.ol} start={2}>
|
|
50
|
-
<ListItem>Banana</ListItem>
|
|
51
|
-
<ListItem>Orange</ListItem>
|
|
52
|
-
</List>
|
|
53
|
-
);
|
|
54
|
-
expect(screen.getByRole('list')).toHaveAttribute('start', '2');
|
|
55
|
-
});
|
|
13
|
+
test(`Renders children for ${component} list`, () => {
|
|
14
|
+
render(<List component={component}>Children content</List>);
|
|
56
15
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<List component={ListComponent.ol} type={OrderType.uppercaseLetter}>
|
|
60
|
-
<ListItem>Banana</ListItem>
|
|
61
|
-
<ListItem>Orange</ListItem>
|
|
62
|
-
</List>
|
|
63
|
-
);
|
|
64
|
-
expect(screen.getByRole('list')).toHaveAttribute('type', 'A');
|
|
65
|
-
});
|
|
16
|
+
expect(screen.getByRole('list')).toHaveTextContent('Children content');
|
|
17
|
+
});
|
|
66
18
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
19
|
+
test(`Renders with ${component} tag`, () => {
|
|
20
|
+
render(<List component={component}></List>);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByRole('list').tagName).toBe(component.toUpperCase());
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test(`Renders with only class ${styles.list} by default for ${component} list`, () => {
|
|
26
|
+
render(<List component={component}></List>);
|
|
27
|
+
|
|
28
|
+
expect(screen.getByRole('list')).toHaveClass(styles.list, { exact: true });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test(`Renders with custom class when className is passed for ${component} list`, () => {
|
|
32
|
+
render(<List component={component} className="custom-class"></List>);
|
|
33
|
+
|
|
34
|
+
expect(screen.getByRole('list')).toHaveClass('custom-class');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test(`Renders with variant class ${styles.modifiers.inline} when variant prop is inline for ${component} list`, () => {
|
|
38
|
+
render(<List component={component} variant={ListVariant.inline}></List>);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByRole('list')).toHaveClass(styles.modifiers.inline);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test(`Renders with class ${styles.modifiers.bordered} when isBordered is true for ${component} list`, () => {
|
|
44
|
+
render(<List component={component} isBordered></List>);
|
|
45
|
+
|
|
46
|
+
expect(screen.getByRole('list')).toHaveClass(styles.modifiers.bordered);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test(`Renders with class ${styles.modifiers.plain} when isPlain is true for ${component} list`, () => {
|
|
50
|
+
render(<List component={component} isPlain></List>);
|
|
77
51
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
52
|
+
expect(screen.getByRole('list')).toHaveClass(styles.modifiers.plain);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test(`Renders with class ${styles.modifiers.iconLg} when iconSize is "large" for ${component} list`, () => {
|
|
56
|
+
render(<List component={component} iconSize="large"></List>);
|
|
57
|
+
|
|
58
|
+
expect(screen.getByRole('list')).toHaveClass(styles.modifiers.iconLg);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test(`Renders with aria-label for ${component} list`, () => {
|
|
62
|
+
render(<List component={component} aria-label="Testing stuff"></List>);
|
|
63
|
+
|
|
64
|
+
expect(screen.getByRole('list')).toHaveAccessibleName('Testing stuff');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test(`Spreads additional props when passed for ${component} list`, () => {
|
|
68
|
+
render(<List component={component} id="Test ID"></List>);
|
|
69
|
+
|
|
70
|
+
expect(screen.getByRole('list')).toHaveAttribute('id', 'Test ID');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test(`Does not render with role attribute when isPlain is false for ${component} list`, () => {
|
|
74
|
+
render(<List component={component}></List>);
|
|
75
|
+
|
|
76
|
+
expect(screen.getByRole('list')).not.toHaveAttribute('role');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test(`Renders with role attribute of "list" when isPlain is true for ${component} list`, () => {
|
|
80
|
+
render(<List component={component} isPlain></List>);
|
|
81
|
+
|
|
82
|
+
expect(screen.getByRole('list')).toHaveAttribute('role', 'list');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test(`Matches snapshot for ${component} list`, () => {
|
|
86
|
+
const { asFragment } = render(<List component={component}></List>);
|
|
87
|
+
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
89
|
+
});
|
|
85
90
|
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('Ol component list', () => {
|
|
94
|
+
test(`Renders with type of "1" by default`, () => {
|
|
95
|
+
render(<List component={ListComponent.ol}></List>);
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
render(
|
|
89
|
-
<List isPlain>
|
|
90
|
-
<ListItems />
|
|
91
|
-
</List>
|
|
92
|
-
);
|
|
93
|
-
expect(screen.getAllByRole('list')[0]).toHaveClass('pf-m-plain');
|
|
97
|
+
expect(screen.getByRole('list')).toHaveAttribute('type', '1');
|
|
94
98
|
});
|
|
95
99
|
|
|
96
|
-
test(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<ListItem icon={<Key />}>Banana</ListItem>
|
|
101
|
-
<ListItem icon={<Desktop />}>Orange</ListItem>
|
|
102
|
-
</List>
|
|
103
|
-
);
|
|
104
|
-
expect(asFragment()).toMatchSnapshot();
|
|
100
|
+
test(`Renders with type attribute when type is passed`, () => {
|
|
101
|
+
render(<List component={ListComponent.ol} type={OrderType.uppercaseLetter}></List>);
|
|
102
|
+
|
|
103
|
+
expect(screen.getByRole('list')).toHaveAttribute('type', 'A');
|
|
105
104
|
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('Ul component list', () => {
|
|
108
|
+
test(`Does not render with type attribute when type is passed`, () => {
|
|
109
|
+
render(<List type={OrderType.lowercaseRomanNumber}></List>);
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
const { asFragment } = render(
|
|
109
|
-
<List iconSize="large">
|
|
110
|
-
<ListItem icon={<BookOpen />}>Apple</ListItem>
|
|
111
|
-
<ListItem icon={<Key />}>Banana</ListItem>
|
|
112
|
-
<ListItem icon={<Desktop />}>Orange</ListItem>
|
|
113
|
-
</List>
|
|
114
|
-
);
|
|
115
|
-
expect(asFragment()).toMatchSnapshot();
|
|
111
|
+
expect(screen.getByRole('list')).not.toHaveAttribute('type');
|
|
116
112
|
});
|
|
117
113
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { ListItem } from '../ListItem';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/List/list';
|
|
4
|
+
|
|
5
|
+
test('Renders with children', () => {
|
|
6
|
+
render(<ListItem>List item content</ListItem>);
|
|
7
|
+
|
|
8
|
+
expect(screen.getByRole('listitem')).toHaveTextContent('List item content');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test(`Does not render with a class by default`, () => {
|
|
12
|
+
render(<ListItem>List item content</ListItem>);
|
|
13
|
+
|
|
14
|
+
expect(screen.getByRole('listitem')).not.toHaveClass();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test(`Renders with custom class when className is passed`, () => {
|
|
18
|
+
render(<ListItem className="test-class">List item content</ListItem>);
|
|
19
|
+
|
|
20
|
+
expect(screen.getByRole('listitem')).toHaveClass('test-class', { exact: true });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test(`Renders with icon content when icon prop is passed`, () => {
|
|
24
|
+
render(<ListItem icon={<div>Icon content</div>}>List item content</ListItem>);
|
|
25
|
+
|
|
26
|
+
expect(screen.getByRole('listitem')).toContainHTML('<div>Icon content</div>');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test(`Renders with class ${styles.listItem} when icon prop is passed`, () => {
|
|
30
|
+
render(<ListItem icon={<div>Icon content</div>}>List item content</ListItem>);
|
|
31
|
+
|
|
32
|
+
expect(screen.getByRole('listitem')).toHaveClass(styles.listItem, { exact: true });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test(`Spreads additional props when passed`, () => {
|
|
36
|
+
render(<ListItem id="test-ID">List item content</ListItem>);
|
|
37
|
+
|
|
38
|
+
expect(screen.getByRole('listitem')).toHaveAttribute('id', 'test-ID');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Matches snapshot without icon', () => {
|
|
42
|
+
const { asFragment } = render(<ListItem>List item content</ListItem>);
|
|
43
|
+
|
|
44
|
+
expect(asFragment()).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Matches snapshot with icon', () => {
|
|
48
|
+
const { asFragment } = render(<ListItem icon={<div>Icon content</div>}>List item content</ListItem>);
|
|
49
|
+
|
|
50
|
+
expect(asFragment()).toMatchSnapshot();
|
|
51
|
+
});
|
|
@@ -1,275 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<ul
|
|
6
|
-
class="pf-v6-c-list pf-m-icon-lg"
|
|
7
|
-
>
|
|
8
|
-
<li
|
|
9
|
-
class="pf-v6-c-list__item"
|
|
10
|
-
>
|
|
11
|
-
<span
|
|
12
|
-
class="pf-v6-c-list__item-icon"
|
|
13
|
-
>
|
|
14
|
-
<svg
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
class="pf-v6-svg"
|
|
17
|
-
fill="currentColor"
|
|
18
|
-
height="1em"
|
|
19
|
-
role="img"
|
|
20
|
-
viewBox="0 0 576 512"
|
|
21
|
-
width="1em"
|
|
22
|
-
>
|
|
23
|
-
<path
|
|
24
|
-
d="M542.22 32.05c-54.8 3.11-163.72 14.43-230.96 55.59-4.64 2.84-7.27 7.89-7.27 13.17v363.87c0 11.55 12.63 18.85 23.28 13.49 69.18-34.82 169.23-44.32 218.7-46.92 16.89-.89 30.02-14.43 30.02-30.66V62.75c.01-17.71-15.35-31.74-33.77-30.7zM264.73 87.64C197.5 46.48 88.58 35.17 33.78 32.05 15.36 31.01 0 45.04 0 62.75V400.6c0 16.24 13.13 29.78 30.02 30.66 49.49 2.6 149.59 12.11 218.77 46.95 10.62 5.35 23.21-1.94 23.21-13.46V100.63c0-5.29-2.62-10.14-7.27-12.99z"
|
|
25
|
-
/>
|
|
26
|
-
</svg>
|
|
27
|
-
</span>
|
|
28
|
-
<span
|
|
29
|
-
class="pf-v6-c-list__item-text"
|
|
30
|
-
>
|
|
31
|
-
Apple
|
|
32
|
-
</span>
|
|
33
|
-
</li>
|
|
34
|
-
<li
|
|
35
|
-
class="pf-v6-c-list__item"
|
|
36
|
-
>
|
|
37
|
-
<span
|
|
38
|
-
class="pf-v6-c-list__item-icon"
|
|
39
|
-
>
|
|
40
|
-
<svg
|
|
41
|
-
aria-hidden="true"
|
|
42
|
-
class="pf-v6-svg"
|
|
43
|
-
fill="currentColor"
|
|
44
|
-
height="1em"
|
|
45
|
-
role="img"
|
|
46
|
-
viewBox="0 0 1024 1024"
|
|
47
|
-
width="1em"
|
|
48
|
-
>
|
|
49
|
-
<path
|
|
50
|
-
d="M802,320 C748.980664,320 706,277.019336 706,224 C706,170.980664 748.980664,128 802,128 C855.019336,128 898,170.980664 898,224 C898,277.019336 855.019336,320 802,320 M704,0 C527.3,0 384,143.3 384,320 C383.937788,357.490503 390.505571,394.696657 403.4,429.9 L0,824.1 L0,1024 L192,1024 L192,896 L320,896 L320,768 L448,768 L597,622 C596.906403,621.881923 596.838304,621.745723 596.8,621.6 C631.220126,633.811107 667.47802,640.034477 704,640 C880.7,640 1024,496.7 1024,320 C1024,143.3 880.7,0 704,0"
|
|
51
|
-
/>
|
|
52
|
-
</svg>
|
|
53
|
-
</span>
|
|
54
|
-
<span
|
|
55
|
-
class="pf-v6-c-list__item-text"
|
|
56
|
-
>
|
|
57
|
-
Banana
|
|
58
|
-
</span>
|
|
59
|
-
</li>
|
|
60
|
-
<li
|
|
61
|
-
class="pf-v6-c-list__item"
|
|
62
|
-
>
|
|
63
|
-
<span
|
|
64
|
-
class="pf-v6-c-list__item-icon"
|
|
65
|
-
>
|
|
66
|
-
<svg
|
|
67
|
-
aria-hidden="true"
|
|
68
|
-
class="pf-v6-svg"
|
|
69
|
-
fill="currentColor"
|
|
70
|
-
height="1em"
|
|
71
|
-
role="img"
|
|
72
|
-
viewBox="0 0 576 512"
|
|
73
|
-
width="1em"
|
|
74
|
-
>
|
|
75
|
-
<path
|
|
76
|
-
d="M528 0H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h192l-16 48h-72c-13.3 0-24 10.7-24 24s10.7 24 24 24h272c13.3 0 24-10.7 24-24s-10.7-24-24-24h-72l-16-48h192c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm-16 352H64V64h448v288z"
|
|
77
|
-
/>
|
|
78
|
-
</svg>
|
|
79
|
-
</span>
|
|
80
|
-
<span
|
|
81
|
-
class="pf-v6-c-list__item-text"
|
|
82
|
-
>
|
|
83
|
-
Orange
|
|
84
|
-
</span>
|
|
85
|
-
</li>
|
|
86
|
-
</ul>
|
|
87
|
-
</DocumentFragment>
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
exports[`List icon list 1`] = `
|
|
91
|
-
<DocumentFragment>
|
|
92
|
-
<ul
|
|
93
|
-
class="pf-v6-c-list pf-m-plain"
|
|
94
|
-
role="list"
|
|
95
|
-
>
|
|
96
|
-
<li
|
|
97
|
-
class="pf-v6-c-list__item"
|
|
98
|
-
>
|
|
99
|
-
<span
|
|
100
|
-
class="pf-v6-c-list__item-icon"
|
|
101
|
-
>
|
|
102
|
-
<svg
|
|
103
|
-
aria-hidden="true"
|
|
104
|
-
class="pf-v6-svg"
|
|
105
|
-
fill="currentColor"
|
|
106
|
-
height="1em"
|
|
107
|
-
role="img"
|
|
108
|
-
viewBox="0 0 576 512"
|
|
109
|
-
width="1em"
|
|
110
|
-
>
|
|
111
|
-
<path
|
|
112
|
-
d="M542.22 32.05c-54.8 3.11-163.72 14.43-230.96 55.59-4.64 2.84-7.27 7.89-7.27 13.17v363.87c0 11.55 12.63 18.85 23.28 13.49 69.18-34.82 169.23-44.32 218.7-46.92 16.89-.89 30.02-14.43 30.02-30.66V62.75c.01-17.71-15.35-31.74-33.77-30.7zM264.73 87.64C197.5 46.48 88.58 35.17 33.78 32.05 15.36 31.01 0 45.04 0 62.75V400.6c0 16.24 13.13 29.78 30.02 30.66 49.49 2.6 149.59 12.11 218.77 46.95 10.62 5.35 23.21-1.94 23.21-13.46V100.63c0-5.29-2.62-10.14-7.27-12.99z"
|
|
113
|
-
/>
|
|
114
|
-
</svg>
|
|
115
|
-
</span>
|
|
116
|
-
<span
|
|
117
|
-
class="pf-v6-c-list__item-text"
|
|
118
|
-
>
|
|
119
|
-
Apple
|
|
120
|
-
</span>
|
|
121
|
-
</li>
|
|
122
|
-
<li
|
|
123
|
-
class="pf-v6-c-list__item"
|
|
124
|
-
>
|
|
125
|
-
<span
|
|
126
|
-
class="pf-v6-c-list__item-icon"
|
|
127
|
-
>
|
|
128
|
-
<svg
|
|
129
|
-
aria-hidden="true"
|
|
130
|
-
class="pf-v6-svg"
|
|
131
|
-
fill="currentColor"
|
|
132
|
-
height="1em"
|
|
133
|
-
role="img"
|
|
134
|
-
viewBox="0 0 1024 1024"
|
|
135
|
-
width="1em"
|
|
136
|
-
>
|
|
137
|
-
<path
|
|
138
|
-
d="M802,320 C748.980664,320 706,277.019336 706,224 C706,170.980664 748.980664,128 802,128 C855.019336,128 898,170.980664 898,224 C898,277.019336 855.019336,320 802,320 M704,0 C527.3,0 384,143.3 384,320 C383.937788,357.490503 390.505571,394.696657 403.4,429.9 L0,824.1 L0,1024 L192,1024 L192,896 L320,896 L320,768 L448,768 L597,622 C596.906403,621.881923 596.838304,621.745723 596.8,621.6 C631.220126,633.811107 667.47802,640.034477 704,640 C880.7,640 1024,496.7 1024,320 C1024,143.3 880.7,0 704,0"
|
|
139
|
-
/>
|
|
140
|
-
</svg>
|
|
141
|
-
</span>
|
|
142
|
-
<span
|
|
143
|
-
class="pf-v6-c-list__item-text"
|
|
144
|
-
>
|
|
145
|
-
Banana
|
|
146
|
-
</span>
|
|
147
|
-
</li>
|
|
148
|
-
<li
|
|
149
|
-
class="pf-v6-c-list__item"
|
|
150
|
-
>
|
|
151
|
-
<span
|
|
152
|
-
class="pf-v6-c-list__item-icon"
|
|
153
|
-
>
|
|
154
|
-
<svg
|
|
155
|
-
aria-hidden="true"
|
|
156
|
-
class="pf-v6-svg"
|
|
157
|
-
fill="currentColor"
|
|
158
|
-
height="1em"
|
|
159
|
-
role="img"
|
|
160
|
-
viewBox="0 0 576 512"
|
|
161
|
-
width="1em"
|
|
162
|
-
>
|
|
163
|
-
<path
|
|
164
|
-
d="M528 0H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h192l-16 48h-72c-13.3 0-24 10.7-24 24s10.7 24 24 24h272c13.3 0 24-10.7 24-24s-10.7-24-24-24h-72l-16-48h192c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm-16 352H64V64h448v288z"
|
|
165
|
-
/>
|
|
166
|
-
</svg>
|
|
167
|
-
</span>
|
|
168
|
-
<span
|
|
169
|
-
class="pf-v6-c-list__item-text"
|
|
170
|
-
>
|
|
171
|
-
Orange
|
|
172
|
-
</span>
|
|
173
|
-
</li>
|
|
174
|
-
</ul>
|
|
175
|
-
</DocumentFragment>
|
|
176
|
-
`;
|
|
177
|
-
|
|
178
|
-
exports[`List inline list 1`] = `
|
|
179
|
-
<DocumentFragment>
|
|
180
|
-
<ul
|
|
181
|
-
class="pf-v6-c-list pf-m-inline"
|
|
182
|
-
>
|
|
183
|
-
<ul
|
|
184
|
-
class="pf-v6-c-list"
|
|
185
|
-
>
|
|
186
|
-
<li
|
|
187
|
-
class=""
|
|
188
|
-
>
|
|
189
|
-
<span>
|
|
190
|
-
First
|
|
191
|
-
</span>
|
|
192
|
-
</li>
|
|
193
|
-
<li
|
|
194
|
-
class=""
|
|
195
|
-
>
|
|
196
|
-
<span>
|
|
197
|
-
Second
|
|
198
|
-
</span>
|
|
199
|
-
</li>
|
|
200
|
-
<li
|
|
201
|
-
class=""
|
|
202
|
-
>
|
|
203
|
-
<span>
|
|
204
|
-
Third
|
|
205
|
-
</span>
|
|
206
|
-
</li>
|
|
207
|
-
</ul>
|
|
208
|
-
</ul>
|
|
209
|
-
</DocumentFragment>
|
|
210
|
-
`;
|
|
211
|
-
|
|
212
|
-
exports[`List ordered list 1`] = `
|
|
3
|
+
exports[`Shared tests between ol and ul lists Matches snapshot for ol list 1`] = `
|
|
213
4
|
<DocumentFragment>
|
|
214
5
|
<ol
|
|
215
6
|
class="pf-v6-c-list"
|
|
216
7
|
type="1"
|
|
217
|
-
|
|
218
|
-
<li
|
|
219
|
-
class=""
|
|
220
|
-
>
|
|
221
|
-
<span>
|
|
222
|
-
Apple
|
|
223
|
-
</span>
|
|
224
|
-
</li>
|
|
225
|
-
<li
|
|
226
|
-
class=""
|
|
227
|
-
>
|
|
228
|
-
<span>
|
|
229
|
-
Banana
|
|
230
|
-
</span>
|
|
231
|
-
</li>
|
|
232
|
-
<li
|
|
233
|
-
class=""
|
|
234
|
-
>
|
|
235
|
-
<span>
|
|
236
|
-
Orange
|
|
237
|
-
</span>
|
|
238
|
-
</li>
|
|
239
|
-
</ol>
|
|
8
|
+
/>
|
|
240
9
|
</DocumentFragment>
|
|
241
10
|
`;
|
|
242
11
|
|
|
243
|
-
exports[`
|
|
12
|
+
exports[`Shared tests between ol and ul lists Matches snapshot for ul list 1`] = `
|
|
244
13
|
<DocumentFragment>
|
|
245
14
|
<ul
|
|
246
15
|
class="pf-v6-c-list"
|
|
247
|
-
|
|
248
|
-
<ul
|
|
249
|
-
class="pf-v6-c-list"
|
|
250
|
-
>
|
|
251
|
-
<li
|
|
252
|
-
class=""
|
|
253
|
-
>
|
|
254
|
-
<span>
|
|
255
|
-
First
|
|
256
|
-
</span>
|
|
257
|
-
</li>
|
|
258
|
-
<li
|
|
259
|
-
class=""
|
|
260
|
-
>
|
|
261
|
-
<span>
|
|
262
|
-
Second
|
|
263
|
-
</span>
|
|
264
|
-
</li>
|
|
265
|
-
<li
|
|
266
|
-
class=""
|
|
267
|
-
>
|
|
268
|
-
<span>
|
|
269
|
-
Third
|
|
270
|
-
</span>
|
|
271
|
-
</li>
|
|
272
|
-
</ul>
|
|
273
|
-
</ul>
|
|
16
|
+
/>
|
|
274
17
|
</DocumentFragment>
|
|
275
18
|
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Matches snapshot with icon 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<li
|
|
6
|
+
class="pf-v6-c-list__item"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
class="pf-v6-c-list__item-icon"
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
Icon content
|
|
13
|
+
</div>
|
|
14
|
+
</span>
|
|
15
|
+
<span
|
|
16
|
+
class="pf-v6-c-list__item-text"
|
|
17
|
+
>
|
|
18
|
+
List item content
|
|
19
|
+
</span>
|
|
20
|
+
</li>
|
|
21
|
+
</DocumentFragment>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`Matches snapshot without icon 1`] = `
|
|
25
|
+
<DocumentFragment>
|
|
26
|
+
<li
|
|
27
|
+
class=""
|
|
28
|
+
>
|
|
29
|
+
<span>
|
|
30
|
+
List item content
|
|
31
|
+
</span>
|
|
32
|
+
</li>
|
|
33
|
+
</DocumentFragment>
|
|
34
|
+
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This test was generated
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
import { ListItem } from '../../ListItem';
|
|
6
|
-
// any missing imports can usually be resolved by adding them here
|
|
7
|
-
import {} from '../..';
|
|
8
|
-
|
|
9
|
-
it('ListItem should match snapshot (auto-generated)', () => {
|
|
10
|
-
const { asFragment } = render(<ListItem children={<>ReactNode</>} />);
|
|
11
|
-
expect(asFragment()).toMatchSnapshot();
|
|
12
|
-
});
|