@patternfly/react-core 4.202.12 → 4.202.13
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 +11 -0
- package/dist/esm/components/LoginPage/LoginFooterItem.d.ts.map +1 -1
- package/dist/esm/components/LoginPage/LoginFooterItem.js +1 -3
- package/dist/esm/components/LoginPage/LoginFooterItem.js.map +1 -1
- package/dist/esm/components/TextInput/TextInput.d.ts +1 -0
- package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/esm/components/TextInput/TextInput.js +2 -1
- package/dist/esm/components/TextInput/TextInput.js.map +1 -1
- package/dist/js/components/LoginPage/LoginFooterItem.d.ts.map +1 -1
- package/dist/js/components/LoginPage/LoginFooterItem.js +1 -3
- package/dist/js/components/LoginPage/LoginFooterItem.js.map +1 -1
- package/dist/js/components/TextInput/TextInput.d.ts +1 -0
- package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/js/components/TextInput/TextInput.js +2 -1
- package/dist/js/components/TextInput/TextInput.js.map +1 -1
- package/dist/umd/react-core.js +3 -4
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +5 -5
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +46 -42
- package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +5 -130
- package/src/components/Form/__tests__/FormGroup.test.tsx +82 -57
- package/src/components/Form/__tests__/FormHelperText.test.tsx +42 -28
- package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +51 -250
- package/src/components/Form/__tests__/__snapshots__/FormHelperText.test.tsx.snap +4 -44
- package/src/components/FormSelect/__tests__/FormSelect.test.tsx +131 -122
- package/src/components/FormSelect/__tests__/__snapshots__/FormSelect.test.tsx.snap +9 -301
- package/src/components/InputGroup/__tests__/InputGroup.test.tsx +17 -41
- package/src/components/InputGroup/__tests__/InputGroupText.test.tsx +17 -0
- package/src/components/Label/__tests__/Label.test.tsx +127 -68
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +26 -828
- package/src/components/LabelGroup/__tests__/LabelGroup.test.tsx +24 -20
- package/src/components/LabelGroup/__tests__/__snapshots__/LabelGroup.test.tsx.snap +10 -12
- package/src/components/LoginPage/LoginFooterItem.tsx +0 -2
- package/src/components/LoginPage/__tests__/LoginFooterItem.test.tsx +23 -24
- package/src/components/LoginPage/__tests__/LoginForm.test.tsx +40 -33
- package/src/components/LoginPage/__tests__/LoginMainBody.test.tsx +10 -16
- package/src/components/LoginPage/__tests__/LoginMainFooter.test.tsx +11 -17
- package/src/components/LoginPage/__tests__/LoginMainFooterBandItem.test.tsx +23 -24
- package/src/components/LoginPage/__tests__/LoginMainFooterLinksItem.test.tsx +20 -24
- package/src/components/LoginPage/__tests__/LoginMainHeader.test.tsx +14 -20
- package/src/components/LoginPage/__tests__/__snapshots__/LoginFooterItem.test.tsx.snap +3 -13
- package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +3 -415
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainBody.test.tsx.snap +2 -8
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooter.test.tsx.snap +2 -8
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooterBandItem.test.tsx.snap +3 -17
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooterLinksItem.test.tsx.snap +3 -31
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainHeader.test.tsx.snap +3 -12
- package/src/components/TextInput/TextInput.tsx +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.202.
|
|
3
|
+
"version": "4.202.13",
|
|
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",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.53.
|
|
38
|
-
"@patternfly/react-styles": "^4.52.
|
|
39
|
-
"@patternfly/react-tokens": "^4.54.
|
|
37
|
+
"@patternfly/react-icons": "^4.53.13",
|
|
38
|
+
"@patternfly/react-styles": "^4.52.13",
|
|
39
|
+
"@patternfly/react-tokens": "^4.54.13",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0ff888e73d650c335d23830b042265f36bf28230"
|
|
64
64
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
|
|
4
6
|
import AddressBookIcon from '@patternfly/react-icons/dist/esm/icons/address-book-icon';
|
|
5
7
|
import { EmptyState, EmptyStateVariant } from '../EmptyState';
|
|
6
8
|
import { EmptyStateBody } from '../EmptyStateBody';
|
|
@@ -12,8 +14,8 @@ import { Title, TitleSizes } from '../../Title';
|
|
|
12
14
|
|
|
13
15
|
describe('EmptyState', () => {
|
|
14
16
|
test('Main', () => {
|
|
15
|
-
|
|
16
|
-
<EmptyState>
|
|
17
|
+
render(
|
|
18
|
+
<EmptyState data-testid="empty-state-test-id">
|
|
17
19
|
<Title headingLevel="h5" size="lg">
|
|
18
20
|
HTTP Proxies
|
|
19
21
|
</Title>
|
|
@@ -28,58 +30,59 @@ describe('EmptyState', () => {
|
|
|
28
30
|
</EmptyStateSecondaryActions>
|
|
29
31
|
</EmptyState>
|
|
30
32
|
);
|
|
31
|
-
expect(
|
|
33
|
+
expect(screen.getByTestId('empty-state-test-id').outerHTML).toMatchSnapshot();
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
test('Main variant large', () => {
|
|
35
|
-
|
|
36
|
-
<EmptyState variant={EmptyStateVariant.large}>
|
|
37
|
-
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
37
|
+
render(
|
|
38
|
+
<EmptyState variant={EmptyStateVariant.large} data-testid="empty-state-test-id">
|
|
39
|
+
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
40
|
+
EmptyState large
|
|
41
|
+
</Title>
|
|
38
42
|
</EmptyState>
|
|
39
43
|
);
|
|
40
|
-
expect(
|
|
44
|
+
expect(screen.getByTestId('empty-state-test-id').outerHTML).toMatchSnapshot();
|
|
41
45
|
});
|
|
42
46
|
|
|
43
47
|
test('Main variant small', () => {
|
|
44
|
-
|
|
45
|
-
<EmptyState variant={EmptyStateVariant.small}>
|
|
46
|
-
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
48
|
+
render(
|
|
49
|
+
<EmptyState variant={EmptyStateVariant.small} data-testid="empty-state-test-id">
|
|
50
|
+
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
51
|
+
EmptyState small
|
|
52
|
+
</Title>
|
|
47
53
|
</EmptyState>
|
|
48
54
|
);
|
|
49
|
-
expect(
|
|
55
|
+
expect(screen.getByTestId('empty-state-test-id').outerHTML).toMatchSnapshot();
|
|
50
56
|
});
|
|
51
57
|
|
|
52
58
|
test('Main variant xs', () => {
|
|
53
|
-
|
|
54
|
-
<EmptyState variant={EmptyStateVariant.xs}>
|
|
55
|
-
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
59
|
+
render(
|
|
60
|
+
<EmptyState variant={EmptyStateVariant.xs} data-testid="empty-state-test-id">
|
|
61
|
+
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
62
|
+
EmptyState small
|
|
63
|
+
</Title>
|
|
56
64
|
</EmptyState>
|
|
57
65
|
);
|
|
58
|
-
expect(
|
|
66
|
+
expect(screen.getByTestId('empty-state-test-id').outerHTML).toMatchSnapshot();
|
|
59
67
|
});
|
|
60
68
|
|
|
61
69
|
test('Body', () => {
|
|
62
|
-
|
|
63
|
-
expect(
|
|
64
|
-
expect(view.props().id).toBe('empty-state-1');
|
|
70
|
+
render(<EmptyStateBody className="custom-empty-state-body" data-testid="body-test-id" />);
|
|
71
|
+
expect(screen.getByTestId('body-test-id')).toHaveClass('custom-empty-state-body pf-c-empty-state__body');
|
|
65
72
|
});
|
|
66
73
|
|
|
67
74
|
test('Secondary Action', () => {
|
|
68
|
-
|
|
69
|
-
expect(
|
|
70
|
-
expect(view.props().id).toBe('empty-state-2');
|
|
75
|
+
render(<EmptyStateSecondaryActions className="custom-empty-state-secondary" data-testid="actions-test-id" />);
|
|
76
|
+
expect(screen.getByTestId('actions-test-id')).toHaveClass('custom-empty-state-secondary pf-c-empty-state__secondary');
|
|
71
77
|
});
|
|
72
78
|
|
|
73
79
|
test('Icon', () => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
expect(view.props().className).toBe('pf-c-empty-state__icon custom-empty-state-icon');
|
|
78
|
-
expect(view.props().id).toBe('empty-state-icon');
|
|
80
|
+
render(<EmptyStateIcon icon={AddressBookIcon} data-testid="icon-test-id" />);
|
|
81
|
+
expect(screen.getByTestId('icon-test-id').outerHTML).toContain('pf-c-empty-state__icon');
|
|
79
82
|
});
|
|
80
83
|
|
|
81
84
|
test('Wrap icon in a div', () => {
|
|
82
|
-
const view =
|
|
85
|
+
const view = render(
|
|
83
86
|
<EmptyStateIcon
|
|
84
87
|
variant="container"
|
|
85
88
|
component={AddressBookIcon}
|
|
@@ -87,27 +90,28 @@ describe('EmptyState', () => {
|
|
|
87
90
|
id="empty-state-icon"
|
|
88
91
|
/>
|
|
89
92
|
);
|
|
90
|
-
|
|
91
|
-
expect(view.
|
|
92
|
-
|
|
93
|
+
|
|
94
|
+
expect(view.container.querySelector('div')).toHaveClass('pf-c-empty-state__icon custom-empty-state-icon');
|
|
95
|
+
expect(view.container.querySelector('svg')).toBeInTheDocument();
|
|
96
|
+
})
|
|
93
97
|
|
|
94
98
|
test('Primary div', () => {
|
|
95
|
-
|
|
96
|
-
<EmptyStatePrimary
|
|
99
|
+
render(
|
|
100
|
+
<EmptyStatePrimary data-testid="primary-test-id">
|
|
97
101
|
<Button variant="link">Link</Button>
|
|
98
102
|
</EmptyStatePrimary>
|
|
99
103
|
);
|
|
100
|
-
expect(
|
|
101
|
-
expect(view.props().id).toBe('empty-state-prim-id');
|
|
104
|
+
expect(screen.getByTestId('primary-test-id').className).toContain('pf-c-empty-state__primary');
|
|
102
105
|
});
|
|
103
106
|
|
|
104
107
|
test('Full height', () => {
|
|
105
|
-
|
|
106
|
-
<EmptyState isFullHeight variant={EmptyStateVariant.large}>
|
|
107
|
-
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
108
|
+
render(
|
|
109
|
+
<EmptyState isFullHeight variant={EmptyStateVariant.large} data-testid="empty-state-test-id">
|
|
110
|
+
<Title headingLevel="h3" size={TitleSizes.md}>
|
|
111
|
+
EmptyState large
|
|
112
|
+
</Title>
|
|
108
113
|
</EmptyState>
|
|
109
114
|
);
|
|
110
|
-
expect(
|
|
115
|
+
expect(screen.getByTestId('empty-state-test-id').outerHTML).toMatchSnapshot();
|
|
111
116
|
});
|
|
112
|
-
|
|
113
117
|
});
|
|
@@ -1,136 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`EmptyState Full height 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="pf-c-empty-state pf-m-lg pf-m-full-height"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="pf-c-empty-state__content"
|
|
10
|
-
>
|
|
11
|
-
<h3
|
|
12
|
-
class="pf-c-title pf-m-md"
|
|
13
|
-
data-ouia-component-id="OUIA-Generated-Title-5"
|
|
14
|
-
data-ouia-component-type="PF4/Title"
|
|
15
|
-
data-ouia-safe="true"
|
|
16
|
-
>
|
|
17
|
-
EmptyState large
|
|
18
|
-
</h3>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
3
|
+
exports[`EmptyState Full height 1`] = `"<div class=\\"pf-c-empty-state pf-m-lg pf-m-full-height\\" data-testid=\\"empty-state-test-id\\"><div class=\\"pf-c-empty-state__content\\"><h3 data-ouia-component-type=\\"PF4/Title\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Title-5\\" class=\\"pf-c-title pf-m-md\\">EmptyState large</h3></div></div>"`;
|
|
23
4
|
|
|
24
|
-
exports[`EmptyState Main 1`] = `
|
|
25
|
-
<div>
|
|
26
|
-
<div
|
|
27
|
-
class="pf-c-empty-state"
|
|
28
|
-
>
|
|
29
|
-
<div
|
|
30
|
-
class="pf-c-empty-state__content"
|
|
31
|
-
>
|
|
32
|
-
<h5
|
|
33
|
-
class="pf-c-title pf-m-lg"
|
|
34
|
-
data-ouia-component-id="OUIA-Generated-Title-1"
|
|
35
|
-
data-ouia-component-type="PF4/Title"
|
|
36
|
-
data-ouia-safe="true"
|
|
37
|
-
>
|
|
38
|
-
HTTP Proxies
|
|
39
|
-
</h5>
|
|
40
|
-
<div
|
|
41
|
-
class="pf-c-empty-state__body"
|
|
42
|
-
>
|
|
43
|
-
Defining HTTP Proxies that exist on your network allows you to perform various actions through those proxies.
|
|
44
|
-
</div>
|
|
45
|
-
<button
|
|
46
|
-
aria-disabled="false"
|
|
47
|
-
class="pf-c-button pf-m-primary"
|
|
48
|
-
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
|
49
|
-
data-ouia-component-type="PF4/Button"
|
|
50
|
-
data-ouia-safe="true"
|
|
51
|
-
type="button"
|
|
52
|
-
>
|
|
53
|
-
New HTTP Proxy
|
|
54
|
-
</button>
|
|
55
|
-
<div
|
|
56
|
-
class="pf-c-empty-state__secondary"
|
|
57
|
-
>
|
|
58
|
-
<button
|
|
59
|
-
aria-disabled="false"
|
|
60
|
-
aria-label="learn more action"
|
|
61
|
-
class="pf-c-button pf-m-link"
|
|
62
|
-
data-ouia-component-id="OUIA-Generated-Button-link-1"
|
|
63
|
-
data-ouia-component-type="PF4/Button"
|
|
64
|
-
data-ouia-safe="true"
|
|
65
|
-
type="button"
|
|
66
|
-
>
|
|
67
|
-
Learn more about this in the documentation.
|
|
68
|
-
</button>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
`;
|
|
5
|
+
exports[`EmptyState Main 1`] = `"<div class=\\"pf-c-empty-state\\" data-testid=\\"empty-state-test-id\\"><div class=\\"pf-c-empty-state__content\\"><h5 data-ouia-component-type=\\"PF4/Title\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Title-1\\" class=\\"pf-c-title pf-m-lg\\">HTTP Proxies</h5><div class=\\"pf-c-empty-state__body\\">Defining HTTP Proxies that exist on your network allows you to perform various actions through those proxies.</div><button aria-disabled=\\"false\\" class=\\"pf-c-button pf-m-primary\\" type=\\"button\\" data-ouia-component-type=\\"PF4/Button\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Button-primary-1\\">New HTTP Proxy</button><div class=\\"pf-c-empty-state__secondary\\"><button aria-disabled=\\"false\\" aria-label=\\"learn more action\\" class=\\"pf-c-button pf-m-link\\" type=\\"button\\" data-ouia-component-type=\\"PF4/Button\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Button-link-1\\">Learn more about this in the documentation.</button></div></div></div>"`;
|
|
74
6
|
|
|
75
|
-
exports[`EmptyState Main variant large 1`] = `
|
|
76
|
-
<div>
|
|
77
|
-
<div
|
|
78
|
-
class="pf-c-empty-state pf-m-lg"
|
|
79
|
-
>
|
|
80
|
-
<div
|
|
81
|
-
class="pf-c-empty-state__content"
|
|
82
|
-
>
|
|
83
|
-
<h3
|
|
84
|
-
class="pf-c-title pf-m-md"
|
|
85
|
-
data-ouia-component-id="OUIA-Generated-Title-2"
|
|
86
|
-
data-ouia-component-type="PF4/Title"
|
|
87
|
-
data-ouia-safe="true"
|
|
88
|
-
>
|
|
89
|
-
EmptyState large
|
|
90
|
-
</h3>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
`;
|
|
7
|
+
exports[`EmptyState Main variant large 1`] = `"<div class=\\"pf-c-empty-state pf-m-lg\\" data-testid=\\"empty-state-test-id\\"><div class=\\"pf-c-empty-state__content\\"><h3 data-ouia-component-type=\\"PF4/Title\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Title-2\\" class=\\"pf-c-title pf-m-md\\">EmptyState large</h3></div></div>"`;
|
|
95
8
|
|
|
96
|
-
exports[`EmptyState Main variant small 1`] = `
|
|
97
|
-
<div>
|
|
98
|
-
<div
|
|
99
|
-
class="pf-c-empty-state pf-m-sm"
|
|
100
|
-
>
|
|
101
|
-
<div
|
|
102
|
-
class="pf-c-empty-state__content"
|
|
103
|
-
>
|
|
104
|
-
<h3
|
|
105
|
-
class="pf-c-title pf-m-md"
|
|
106
|
-
data-ouia-component-id="OUIA-Generated-Title-3"
|
|
107
|
-
data-ouia-component-type="PF4/Title"
|
|
108
|
-
data-ouia-safe="true"
|
|
109
|
-
>
|
|
110
|
-
EmptyState small
|
|
111
|
-
</h3>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
`;
|
|
9
|
+
exports[`EmptyState Main variant small 1`] = `"<div class=\\"pf-c-empty-state pf-m-sm\\" data-testid=\\"empty-state-test-id\\"><div class=\\"pf-c-empty-state__content\\"><h3 data-ouia-component-type=\\"PF4/Title\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Title-3\\" class=\\"pf-c-title pf-m-md\\">EmptyState small</h3></div></div>"`;
|
|
116
10
|
|
|
117
|
-
exports[`EmptyState Main variant xs 1`] = `
|
|
118
|
-
<div>
|
|
119
|
-
<div
|
|
120
|
-
class="pf-c-empty-state pf-m-xs"
|
|
121
|
-
>
|
|
122
|
-
<div
|
|
123
|
-
class="pf-c-empty-state__content"
|
|
124
|
-
>
|
|
125
|
-
<h3
|
|
126
|
-
class="pf-c-title pf-m-md"
|
|
127
|
-
data-ouia-component-id="OUIA-Generated-Title-4"
|
|
128
|
-
data-ouia-component-type="PF4/Title"
|
|
129
|
-
data-ouia-safe="true"
|
|
130
|
-
>
|
|
131
|
-
EmptyState small
|
|
132
|
-
</h3>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
`;
|
|
11
|
+
exports[`EmptyState Main variant xs 1`] = `"<div class=\\"pf-c-empty-state pf-m-xs\\" data-testid=\\"empty-state-test-id\\"><div class=\\"pf-c-empty-state__content\\"><h3 data-ouia-component-type=\\"PF4/Title\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Title-4\\" class=\\"pf-c-title pf-m-md\\">EmptyState small</h3></div></div>"`;
|
|
@@ -1,192 +1,217 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
import { ValidatedOptions } from '../../../helpers/constants';
|
|
2
7
|
import { FormGroup } from '../FormGroup';
|
|
3
8
|
import { Form } from '../Form';
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
import { mount } from 'enzyme';
|
|
6
|
-
import { ValidatedOptions } from '../../../helpers/constants';
|
|
7
9
|
|
|
8
|
-
describe('FormGroup
|
|
10
|
+
describe('FormGroup', () => {
|
|
9
11
|
const returnFunction = () => <div>label</div>;
|
|
10
12
|
|
|
11
13
|
test('should render default form group variant', () => {
|
|
12
|
-
const
|
|
14
|
+
const { asFragment } = render(
|
|
13
15
|
<FormGroup label="label" fieldId="label-id" helperText="this is helper text">
|
|
14
16
|
<input id="label-id" />
|
|
15
17
|
</FormGroup>
|
|
16
18
|
);
|
|
17
|
-
expect(
|
|
19
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
test('should render inline form group variant', () => {
|
|
21
|
-
|
|
23
|
+
render(
|
|
22
24
|
<FormGroup isInline label="label" fieldId="label-id" helperText="this is helper text">
|
|
23
25
|
<input id="label-id" />
|
|
24
26
|
</FormGroup>
|
|
25
27
|
);
|
|
26
|
-
expect(
|
|
27
|
-
expect(view.find('.pf-c-form__group-control').prop('className')).toMatch(/pf-m-inline/);
|
|
28
|
+
expect(screen.getByLabelText('label').parentElement).toHaveClass('pf-m-inline');
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
test('should render no padding-top form group variant', () => {
|
|
31
|
-
|
|
32
|
-
<FormGroup
|
|
32
|
+
render(
|
|
33
|
+
<FormGroup
|
|
34
|
+
hasNoPaddingTop
|
|
35
|
+
label="label"
|
|
36
|
+
fieldId="label-id"
|
|
37
|
+
helperText="this is helper text"
|
|
38
|
+
data-testid="form-group-test-id"
|
|
39
|
+
>
|
|
33
40
|
<input id="label-id" />
|
|
34
41
|
</FormGroup>
|
|
35
42
|
);
|
|
36
|
-
expect(
|
|
43
|
+
expect(screen.getByTestId('form-group-test-id').firstElementChild).toHaveClass('pf-m-no-padding-top');
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
test('should render form group variant with required label', () => {
|
|
40
|
-
const
|
|
47
|
+
const { asFragment } = render(
|
|
41
48
|
<FormGroup label="label" isRequired fieldId="label-id">
|
|
42
49
|
<input id="label-id" />
|
|
43
50
|
</FormGroup>
|
|
44
51
|
);
|
|
45
|
-
expect(
|
|
52
|
+
expect(asFragment()).toMatchSnapshot();
|
|
46
53
|
});
|
|
47
54
|
|
|
48
55
|
test('should render form group variant with node label', () => {
|
|
49
|
-
const
|
|
56
|
+
const { asFragment } = render(
|
|
50
57
|
<FormGroup fieldId="id" label={<h1>Header</h1>}>
|
|
51
58
|
<input aria-label="input" />
|
|
52
59
|
</FormGroup>
|
|
53
60
|
);
|
|
54
|
-
expect(
|
|
61
|
+
expect(asFragment()).toMatchSnapshot();
|
|
55
62
|
});
|
|
56
63
|
|
|
57
64
|
test('should render form group with additonal label info', () => {
|
|
58
|
-
const
|
|
65
|
+
const { asFragment } = render(
|
|
59
66
|
<FormGroup fieldId="id" label={<h1>Header</h1>} labelInfo="more info">
|
|
60
67
|
<input aria-label="input" />
|
|
61
68
|
</FormGroup>
|
|
62
69
|
);
|
|
63
|
-
expect(
|
|
70
|
+
expect(asFragment()).toMatchSnapshot();
|
|
64
71
|
});
|
|
65
72
|
|
|
66
73
|
test('should render form group variant with function label', () => {
|
|
67
|
-
|
|
74
|
+
render(
|
|
68
75
|
<FormGroup fieldId="id" label={returnFunction()}>
|
|
69
76
|
<input aria-label="input" />
|
|
70
77
|
</FormGroup>
|
|
71
78
|
);
|
|
72
|
-
|
|
79
|
+
|
|
80
|
+
expect(screen.getByText('label')).toBeInTheDocument();
|
|
73
81
|
});
|
|
74
82
|
|
|
75
83
|
test('should render form group variant with node helperText', () => {
|
|
76
|
-
|
|
84
|
+
render(
|
|
77
85
|
<FormGroup label="Label" fieldId="label-id" helperText={<h1>Header</h1>}>
|
|
78
86
|
<input id="label-id" />
|
|
79
87
|
</FormGroup>
|
|
80
88
|
);
|
|
81
|
-
|
|
89
|
+
|
|
90
|
+
expect(screen.getByRole('heading', { name: 'Header' })).toBeInTheDocument();
|
|
82
91
|
});
|
|
83
92
|
|
|
84
93
|
test('should render form group variant with function helperText', () => {
|
|
85
|
-
|
|
94
|
+
render(
|
|
86
95
|
<FormGroup label="Label" fieldId="label-id" helperText={returnFunction()}>
|
|
87
96
|
<input id="label-id" />
|
|
88
97
|
</FormGroup>
|
|
89
98
|
);
|
|
90
|
-
|
|
99
|
+
|
|
100
|
+
expect(screen.getByText('label')).toBeInTheDocument();
|
|
91
101
|
});
|
|
92
102
|
|
|
93
103
|
test('should render horizontal form group variant', () => {
|
|
94
|
-
const
|
|
104
|
+
const { asFragment } = render(
|
|
95
105
|
<Form isHorizontal>
|
|
96
106
|
<FormGroup label="label" fieldId="label-id" helperText="this is helperText">
|
|
97
107
|
<input id="label-id" />
|
|
98
108
|
</FormGroup>
|
|
99
109
|
</Form>
|
|
100
110
|
);
|
|
101
|
-
expect(
|
|
111
|
+
expect(asFragment()).toMatchSnapshot();
|
|
102
112
|
});
|
|
103
113
|
|
|
104
114
|
test('should render stacked horizontal form group variant', () => {
|
|
105
|
-
const
|
|
115
|
+
const { asFragment } = render(
|
|
106
116
|
<Form isHorizontal>
|
|
107
117
|
<FormGroup label="label" fieldId="label-id" isStack helperText="this is helperText">
|
|
108
118
|
<input id="label-id" />
|
|
109
119
|
</FormGroup>
|
|
110
120
|
</Form>
|
|
111
121
|
);
|
|
112
|
-
expect(
|
|
122
|
+
expect(asFragment()).toMatchSnapshot();
|
|
113
123
|
});
|
|
114
124
|
|
|
115
125
|
test('should render helper text above input', () => {
|
|
116
|
-
const
|
|
126
|
+
const { asFragment } = render(
|
|
117
127
|
<Form isHorizontal>
|
|
118
128
|
<FormGroup label="label" fieldId="label-id" helperText="this is helperText" isHelperTextBeforeField>
|
|
119
129
|
<input id="label-id" />
|
|
120
130
|
</FormGroup>
|
|
121
131
|
</Form>
|
|
122
132
|
);
|
|
123
|
-
expect(
|
|
133
|
+
expect(asFragment()).toMatchSnapshot();
|
|
124
134
|
});
|
|
125
135
|
|
|
126
136
|
test('should render form group variant without label', () => {
|
|
127
|
-
const
|
|
137
|
+
const { asFragment } = render(
|
|
128
138
|
<FormGroup fieldId="id">
|
|
129
139
|
<input aria-label="input" />
|
|
130
140
|
</FormGroup>
|
|
131
141
|
);
|
|
132
|
-
expect(
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test('should render form group required variant', () => {
|
|
136
|
-
const view = render(
|
|
137
|
-
<FormGroup isRequired label="label" fieldId="id">
|
|
138
|
-
<input id="id" />
|
|
139
|
-
</FormGroup>
|
|
140
|
-
);
|
|
141
|
-
expect(view.container).toMatchSnapshot();
|
|
142
|
+
expect(asFragment()).toMatchSnapshot();
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
test('should render form group invalid variant', () => {
|
|
145
|
-
const
|
|
146
|
-
<FormGroup
|
|
146
|
+
const { asFragment } = render(
|
|
147
|
+
<FormGroup
|
|
148
|
+
label="label"
|
|
149
|
+
fieldId="label-id"
|
|
150
|
+
validated={'error'}
|
|
151
|
+
helperTextInvalid="Invalid FormGroup"
|
|
152
|
+
>
|
|
147
153
|
<input id="id" />
|
|
148
154
|
</FormGroup>
|
|
149
155
|
);
|
|
150
|
-
expect(
|
|
156
|
+
expect(asFragment()).toMatchSnapshot();
|
|
151
157
|
});
|
|
152
158
|
|
|
153
159
|
test('should render form group validated success variant', () => {
|
|
154
|
-
const
|
|
155
|
-
<FormGroup
|
|
160
|
+
const { asFragment } = render(
|
|
161
|
+
<FormGroup
|
|
162
|
+
label="label"
|
|
163
|
+
fieldId="label-id"
|
|
164
|
+
validated={ValidatedOptions.success}
|
|
165
|
+
helperText="Validated FormGroup"
|
|
166
|
+
data-testid="form-group-test-id"
|
|
167
|
+
>
|
|
156
168
|
<input id="id" />
|
|
157
169
|
</FormGroup>
|
|
158
170
|
);
|
|
159
|
-
|
|
160
|
-
expect(
|
|
171
|
+
|
|
172
|
+
expect(screen.getByTestId('form-group-test-id').querySelector('input + div')).toHaveClass('pf-m-success');
|
|
173
|
+
expect(asFragment()).toMatchSnapshot();
|
|
161
174
|
});
|
|
162
175
|
|
|
163
176
|
test('should render form group validated error variant', () => {
|
|
164
|
-
const
|
|
165
|
-
<FormGroup
|
|
177
|
+
const { asFragment } = render(
|
|
178
|
+
<FormGroup
|
|
179
|
+
label="label"
|
|
180
|
+
fieldId="label-id"
|
|
181
|
+
validated={ValidatedOptions.error}
|
|
182
|
+
helperText="Validated FormGroup"
|
|
183
|
+
>
|
|
166
184
|
<input id="id" />
|
|
167
185
|
</FormGroup>
|
|
168
186
|
);
|
|
169
|
-
expect(
|
|
187
|
+
expect(asFragment()).toMatchSnapshot();
|
|
170
188
|
});
|
|
171
189
|
|
|
172
190
|
test('should render form group validated warning variant', () => {
|
|
173
|
-
const
|
|
174
|
-
<FormGroup
|
|
191
|
+
const { asFragment } = render(
|
|
192
|
+
<FormGroup
|
|
193
|
+
label="label"
|
|
194
|
+
fieldId="label-id"
|
|
195
|
+
validated={ValidatedOptions.warning}
|
|
196
|
+
helperText="Validated FormGroup"
|
|
197
|
+
data-testid="form-group-test-id"
|
|
198
|
+
>
|
|
175
199
|
<input id="id" />
|
|
176
200
|
</FormGroup>
|
|
177
201
|
);
|
|
178
|
-
|
|
179
|
-
expect(
|
|
202
|
+
|
|
203
|
+
expect(screen.getByTestId('form-group-test-id').querySelector('input + div')).toHaveClass('pf-m-warning');
|
|
204
|
+
expect(asFragment()).toMatchSnapshot();
|
|
180
205
|
});
|
|
181
206
|
|
|
182
207
|
test('should render correctly when label is not a string with Children = Array', () => {
|
|
183
|
-
const
|
|
208
|
+
const { asFragment } = render(
|
|
184
209
|
<FormGroup fieldId="id" label={returnFunction()}>
|
|
185
210
|
<input aria-label="label" />
|
|
186
211
|
<input id="id" />
|
|
187
212
|
<input />
|
|
188
213
|
</FormGroup>
|
|
189
214
|
);
|
|
190
|
-
expect(
|
|
215
|
+
expect(asFragment()).toMatchSnapshot();
|
|
191
216
|
});
|
|
192
217
|
});
|