@patternfly/react-core 4.260.0 → 4.260.1
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/dist/esm/components/Text/TextList.js +1 -1
- package/dist/esm/components/Text/TextList.js.map +1 -1
- package/dist/esm/components/Text/TextListItem.js +1 -1
- package/dist/esm/components/Text/TextListItem.js.map +1 -1
- package/dist/esm/components/Text/__tests__/TextContent.text.d.ts +2 -0
- package/dist/esm/components/Text/__tests__/TextContent.text.d.ts.map +1 -0
- package/dist/esm/components/Text/__tests__/TextContent.text.js +37 -0
- package/dist/esm/components/Text/__tests__/TextContent.text.js.map +1 -0
- package/dist/js/components/Text/TextList.js +1 -1
- package/dist/js/components/Text/TextList.js.map +1 -1
- package/dist/js/components/Text/TextListItem.js +1 -1
- package/dist/js/components/Text/TextListItem.js.map +1 -1
- package/dist/js/components/Text/__tests__/TextContent.text.d.ts +2 -0
- package/dist/js/components/Text/__tests__/TextContent.text.d.ts.map +1 -0
- package/dist/js/components/Text/__tests__/TextContent.text.js +40 -0
- package/dist/js/components/Text/__tests__/TextContent.text.js.map +1 -0
- package/dist/umd/react-core.min.css +2186 -2186
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Text/TextList.tsx +1 -1
- package/src/components/Text/TextListItem.tsx +1 -1
- package/src/components/Text/__tests__/Generated/__snapshots__/TextList.test.tsx.snap +0 -1
- package/src/components/Text/__tests__/Generated/__snapshots__/TextListItem.test.tsx.snap +0 -1
- package/src/components/Text/__tests__/Text.test.tsx +98 -109
- package/src/components/Text/__tests__/TextContent.text.tsx +47 -0
- package/src/components/Text/__tests__/TextList.test.tsx +52 -0
- package/src/components/Text/__tests__/TextListItem.test.tsx +52 -0
- package/src/components/Text/__tests__/__snapshots__/Text.test.tsx.snap +9 -328
- package/src/components/Text/__tests__/__snapshots__/TextContent.text.tsx.snap +11 -0
- package/src/components/Text/__tests__/__snapshots__/TextList.test.tsx.snap +11 -0
- package/src/components/Text/__tests__/__snapshots__/TextListItem.test.tsx.snap +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.260.
|
|
3
|
+
"version": "4.260.1",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "246184250fd0b32f33c87a9226b9cd621c30c16e"
|
|
74
74
|
}
|
|
@@ -25,7 +25,7 @@ export const TextList: React.FunctionComponent<TextListProps> = ({
|
|
|
25
25
|
const Component: any = component;
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Component {...props}
|
|
28
|
+
<Component {...props} className={css(className)}>
|
|
29
29
|
{children}
|
|
30
30
|
</Component>
|
|
31
31
|
);
|
|
@@ -25,7 +25,7 @@ export const TextListItem: React.FunctionComponent<TextListItemProps> = ({
|
|
|
25
25
|
const Component: any = component;
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Component {...props}
|
|
28
|
+
<Component {...props} className={css(className)}>
|
|
29
29
|
{children}
|
|
30
30
|
</Component>
|
|
31
31
|
);
|
|
@@ -1,112 +1,101 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Phasellus porttitor enim id metus volutpat ultricies. Ut nisi nunc, blandit sed dapibus at, vestibulum in felis.
|
|
90
|
-
Etiam iaculis lorem ac nibh bibendum rhoncus. Nam interdum efficitur ligula sit amet ullamcorper. Etiam
|
|
91
|
-
tristique, leo vitae porta faucibus, mi lacus laoreet metus, at cursus leo est vel tellus. Sed ac posuere est.
|
|
92
|
-
Nunc ultricies nunc neque, vitae ultricies ex sodales quis. Aliquam eu nibh in libero accumsan pulvinar. Nullam
|
|
93
|
-
nec nisl placerat, pretium metus vel, euismod ipsum. Proin tempor cursus nisl vel condimentum. Nam pharetra
|
|
94
|
-
varius metus non pellentesque.
|
|
95
|
-
</Text>
|
|
96
|
-
<Text component={TextVariants.h5}>Fifth level</Text>
|
|
97
|
-
<Text component={TextVariants.p}>
|
|
98
|
-
Aliquam sagittis rhoncus vulputate. Cras non luctus sem, sed tincidunt ligula. Vestibulum at nunc elit. Praesent
|
|
99
|
-
aliquet ligula mi, in luctus elit volutpat porta. Phasellus molestie diam vel nisi sodales, a eleifend augue
|
|
100
|
-
laoreet. Sed nec eleifend justo. Nam et sollicitudin odio.
|
|
101
|
-
</Text>
|
|
102
|
-
<Text component={TextVariants.h6}>Sixth level</Text>
|
|
103
|
-
<Text component={TextVariants.p}>
|
|
104
|
-
Cras in nibh lacinia, venenatis nisi et, auctor urna. Donec pulvinar lacus sed diam dignissim, ut eleifend eros
|
|
105
|
-
accumsan. Phasellus non tortor eros. Ut sed rutrum lacus. Etiam purus nunc, scelerisque quis enim vitae,
|
|
106
|
-
malesuada ultrices turpis. Nunc vitae maximus purus, nec consectetur dui. Suspendisse euismod, elit vel rutrum
|
|
107
|
-
commodo, ipsum tortor maximus dui, sed varius sapien odio vitae est. Etiam at cursus metus.
|
|
108
|
-
</Text>
|
|
109
|
-
</TextContent>
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Text } from '../Text';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-content">
|
|
8
|
+
<Text />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-content').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<Text>Test</Text>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders without class name by default', () => {
|
|
20
|
+
render(<Text>Test</Text>);
|
|
21
|
+
expect(screen.getByText('Test')).not.toHaveClass();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
25
|
+
render(<Text className="custom-class">Test</Text>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders as "p" element by default', () => {
|
|
30
|
+
render(<Text>Test</Text>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'P');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders as "h1" element when component="h1"', () => {
|
|
35
|
+
render(<Text component="h1">Test</Text>);
|
|
36
|
+
expect(screen.getByRole('heading', { level: 1 })).toBeVisible();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders as "h2" element when component="h2"', () => {
|
|
40
|
+
render(<Text component="h2">Test</Text>);
|
|
41
|
+
expect(screen.getByRole('heading', { level: 2 })).toBeVisible();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Renders as "h3" element when component="h3"', () => {
|
|
45
|
+
render(<Text component="h3">Test</Text>);
|
|
46
|
+
expect(screen.getByRole('heading', { level: 3 })).toBeVisible();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Renders as "h4" element when component="h4"', () => {
|
|
50
|
+
render(<Text component="h4">Test</Text>);
|
|
51
|
+
expect(screen.getByRole('heading', { level: 4 })).toBeVisible();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('Renders as "h5" element when component="h5"', () => {
|
|
55
|
+
render(<Text component="h5">Test</Text>);
|
|
56
|
+
expect(screen.getByRole('heading', { level: 5 })).toBeVisible();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('Renders as "h6" element when component="h6"', () => {
|
|
60
|
+
render(<Text component="h6">Test</Text>);
|
|
61
|
+
expect(screen.getByRole('heading', { level: 6 })).toBeVisible();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('Renders as "a" element when component="a"', () => {
|
|
65
|
+
render(<Text component="a">Test</Text>);
|
|
66
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'A');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('Renders as "blockquote" element when component="blockquote"', () => {
|
|
70
|
+
render(<Text component="blockquote">Test</Text>);
|
|
71
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'BLOCKQUOTE');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('Renders as "pre" element when component="pre"', () => {
|
|
75
|
+
render(<Text component="pre">Test</Text>);
|
|
76
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'PRE');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('Renders without class name pf-m-visited by default', () => {
|
|
80
|
+
render(<Text>Test</Text>);
|
|
81
|
+
expect(screen.getByText('Test')).not.toHaveClass('pf-m-visited');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('Renders with class name pf-m-visited when isVisited=true and component="a"', () => {
|
|
85
|
+
render(
|
|
86
|
+
<Text isVisitedLink={true} component="a">
|
|
87
|
+
Test
|
|
88
|
+
</Text>
|
|
110
89
|
);
|
|
90
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-visited');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
94
|
+
render(<Text aria-label="Test label">Test</Text>);
|
|
95
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('Matches the snapshot', () => {
|
|
99
|
+
const { asFragment } = render(<Text ouiaId="ouia-id">Test</Text>);
|
|
111
100
|
expect(asFragment()).toMatchSnapshot();
|
|
112
101
|
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { TextContent } from '../TextContent';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-content">
|
|
8
|
+
<TextContent />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-content').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<TextContent>Test</TextContent>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders with class name pf-c-content', () => {
|
|
20
|
+
render(<TextContent>Test</TextContent>);
|
|
21
|
+
expect(screen.getByText('Test')).toHaveClass('pf-c-content', { exact: true });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
25
|
+
render(<TextContent className="custom-class">Test</TextContent>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders without class name pf-m-visited by default', () => {
|
|
30
|
+
render(<TextContent>Test</TextContent>);
|
|
31
|
+
expect(screen.getByText('Test')).not.toHaveClass('pf-m-visited');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders with class name pf-m-visited when isVisited=true', () => {
|
|
35
|
+
render(<TextContent isVisited={true}>Test</TextContent>);
|
|
36
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-visited');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
40
|
+
render(<TextContent aria-label="Test label">Test</TextContent>);
|
|
41
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Matches the snapshot', () => {
|
|
45
|
+
const { asFragment } = render(<TextContent>Test</TextContent>);
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
47
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { TextList } from '../TextList';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-list">
|
|
8
|
+
<TextList />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-list').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<TextList>Test</TextList>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders without class name by default', () => {
|
|
20
|
+
render(<TextList>Test</TextList>);
|
|
21
|
+
expect(screen.getByText('Test')).not.toHaveClass();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
25
|
+
render(<TextList className="custom-class">Test</TextList>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders as "ul" element by default', () => {
|
|
30
|
+
render(<TextList>Test</TextList>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'UL');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders as "ol" element when component="ol"', () => {
|
|
35
|
+
render(<TextList component="ol">Test</TextList>);
|
|
36
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'OL');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders as "dl" element when component="dl"', () => {
|
|
40
|
+
render(<TextList component="dl">Test</TextList>);
|
|
41
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'DL');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
45
|
+
render(<TextList aria-label="Test label">Test</TextList>);
|
|
46
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Matches the snapshot', () => {
|
|
50
|
+
const { asFragment } = render(<TextList>Test</TextList>);
|
|
51
|
+
expect(asFragment()).toMatchSnapshot();
|
|
52
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { TextListItem } from '../TextListItem';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-list-item">
|
|
8
|
+
<TextListItem />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-list-item').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<TextListItem>Test</TextListItem>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders without class name by default', () => {
|
|
20
|
+
render(<TextListItem>Test</TextListItem>);
|
|
21
|
+
expect(screen.getByText('Test')).not.toHaveClass();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
25
|
+
render(<TextListItem className="custom-class">Test</TextListItem>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders as "li" element by default', () => {
|
|
30
|
+
render(<TextListItem>Test</TextListItem>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'LI');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders as "dt" element when component="dt"', () => {
|
|
35
|
+
render(<TextListItem component="dt">Test</TextListItem>);
|
|
36
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'DT');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders as "dd" element when component="dd"', () => {
|
|
40
|
+
render(<TextListItem component="dd">Test</TextListItem>);
|
|
41
|
+
expect(screen.getByText('Test')).toHaveProperty('nodeName', 'DD');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
45
|
+
render(<TextListItem aria-label="Test label">Test</TextListItem>);
|
|
46
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Matches the snapshot', () => {
|
|
50
|
+
const { asFragment } = render(<TextListItem>Test</TextListItem>);
|
|
51
|
+
expect(asFragment()).toMatchSnapshot();
|
|
52
|
+
});
|