@patternfly/react-core 4.202.12 → 4.202.15
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 +27 -0
- package/dist/esm/components/Drawer/DrawerContent.js +1 -1
- package/dist/esm/components/Drawer/DrawerContent.js.map +1 -1
- 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/Drawer/DrawerContent.js +1 -1
- package/dist/js/components/Drawer/DrawerContent.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 +4 -5
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Drawer/DrawerContent.tsx +1 -1
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
import { InputGroupText, InputGroupTextVariant } from '../InputGroupText';
|
|
7
|
+
|
|
8
|
+
describe('InputGroupText', () => {
|
|
9
|
+
test('renders', () => {
|
|
10
|
+
render(
|
|
11
|
+
<InputGroupText className="inpt-grp-text" variant={InputGroupTextVariant.plain} id="email-npt-grp">
|
|
12
|
+
@
|
|
13
|
+
</InputGroupText>
|
|
14
|
+
);
|
|
15
|
+
expect(screen.getByText('@')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -1,84 +1,143 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
|
|
4
7
|
import { Label } from '../Label';
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
const view = render(<Label>Something</Label>);
|
|
8
|
-
expect(view.container).toMatchSnapshot();
|
|
9
|
-
const outline = render(<Label variant="outline">Something</Label>);
|
|
10
|
-
expect(outline).toMatchSnapshot();
|
|
11
|
-
const compact = render(<Label isCompact>Something</Label>);
|
|
12
|
-
expect(compact).toMatchSnapshot();
|
|
13
|
-
});
|
|
9
|
+
const labelColors = ['blue', 'cyan', 'green', 'orange', 'purple', 'red', 'grey'];
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Something
|
|
21
|
-
</Label>
|
|
22
|
-
);
|
|
23
|
-
expect(outline).toMatchSnapshot();
|
|
24
|
-
});
|
|
11
|
+
describe('Label', () => {
|
|
12
|
+
test('renders', () => {
|
|
13
|
+
render(<Label data-testid="label-test-id">Something</Label>);
|
|
14
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
15
|
+
});
|
|
25
16
|
|
|
26
|
-
test('
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
34
|
-
expect(outline).toMatchSnapshot();
|
|
35
|
-
});
|
|
17
|
+
test('renders with outline variant', () => {
|
|
18
|
+
render(
|
|
19
|
+
<Label variant="outline" data-testid="label-test-id">
|
|
20
|
+
Something
|
|
21
|
+
</Label>
|
|
22
|
+
);
|
|
23
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
24
|
+
});
|
|
36
25
|
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
test('renders with isCompact', () => {
|
|
27
|
+
render(
|
|
28
|
+
<Label isCompact data-testid="label-test-id">
|
|
29
|
+
Something
|
|
30
|
+
</Label>
|
|
31
|
+
);
|
|
32
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('label with href', () => {
|
|
36
|
+
render(
|
|
37
|
+
<Label href="#" data-testid="label-test-id">
|
|
38
|
+
Something
|
|
39
|
+
</Label>
|
|
40
|
+
);
|
|
41
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('label with href with outline variant', () => {
|
|
45
|
+
render(
|
|
46
|
+
<Label href="#" variant="outline" data-testid="label-test-id">
|
|
47
|
+
Something
|
|
48
|
+
</Label>
|
|
49
|
+
);
|
|
50
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('label with close button', () => {
|
|
54
|
+
render(
|
|
55
|
+
<Label onClose={jest.fn()} data-testid="label-test-id">
|
|
56
|
+
Something
|
|
57
|
+
</Label>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('label with close button and outline variant', () => {
|
|
64
|
+
render(
|
|
65
|
+
<Label onClose={jest.fn()} variant="outline" data-testid="label-test-id">
|
|
66
|
+
Something
|
|
67
|
+
</Label>
|
|
68
|
+
);
|
|
69
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
labelColors.forEach((color: string) =>
|
|
39
73
|
test(`label with ${color} color`, () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const outline = render(
|
|
43
|
-
<Label color={color as any} variant="outline">
|
|
74
|
+
render(
|
|
75
|
+
<Label color={color as any} data-testid="label-test-id">
|
|
44
76
|
Something
|
|
45
77
|
</Label>
|
|
46
78
|
);
|
|
47
|
-
expect(
|
|
79
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
48
80
|
})
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
test('label with additional class name', () => {
|
|
52
|
-
const view = render(<Label className="klass1">Something</Label>);
|
|
53
|
-
expect(view.container).toMatchSnapshot();
|
|
54
|
-
});
|
|
81
|
+
);
|
|
55
82
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
labelColors.forEach((color: string) =>
|
|
84
|
+
test(`label with ${color} color with outline variant`, () => {
|
|
85
|
+
render(
|
|
86
|
+
<Label color={color as any} variant="outline" data-testid="label-test-id">
|
|
87
|
+
Something
|
|
88
|
+
</Label>
|
|
89
|
+
);
|
|
90
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
91
|
+
})
|
|
61
92
|
);
|
|
62
|
-
expect(view.container).toMatchSnapshot();
|
|
63
|
-
});
|
|
64
93
|
|
|
65
|
-
test('label with
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
test('label with additional class name', () => {
|
|
95
|
+
render(
|
|
96
|
+
<Label className="klass1" data-testid="label-test-id">
|
|
97
|
+
Something
|
|
98
|
+
</Label>
|
|
99
|
+
);
|
|
100
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('label with additional class name and props', () => {
|
|
104
|
+
render(
|
|
105
|
+
<Label className="class-1" id="label-1" data-label-name="something" data-testid="label-test-id">
|
|
106
|
+
Something
|
|
107
|
+
</Label>
|
|
108
|
+
);
|
|
109
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('label with truncation', () => {
|
|
113
|
+
render(
|
|
114
|
+
<Label isTruncated data-testid="label-test-id">
|
|
115
|
+
Something very very very very very long that should be truncated
|
|
116
|
+
</Label>
|
|
117
|
+
);
|
|
118
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('editable label', () => {
|
|
122
|
+
render(
|
|
123
|
+
<Label
|
|
124
|
+
onClose={jest.fn()}
|
|
125
|
+
onEditCancel={jest.fn()}
|
|
126
|
+
onEditComplete={jest.fn()}
|
|
127
|
+
isEditable
|
|
128
|
+
data-testid="label-test-id"
|
|
129
|
+
>
|
|
130
|
+
Something
|
|
131
|
+
</Label>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const button = screen.getByRole('button', { name: 'Something' });
|
|
135
|
+
|
|
136
|
+
expect(button).toBeInTheDocument();
|
|
137
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
69
138
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onEditComplete={jest.fn()}
|
|
75
|
-
isEditable>Something</Label>);
|
|
76
|
-
const button = view.find('button.pf-c-label__content');
|
|
77
|
-
expect(button.length).toBe(1);
|
|
78
|
-
expect(view).toMatchSnapshot();
|
|
79
|
-
|
|
80
|
-
button.simulate('click');
|
|
81
|
-
const clickedButton = view.find('button.pf-c-label__content');
|
|
82
|
-
expect(clickedButton.length).toBe(0);
|
|
83
|
-
expect(view).toMatchSnapshot();
|
|
139
|
+
userEvent.click(button);
|
|
140
|
+
expect(screen.queryByRole('button', { name: 'Something' })).toBeNull();
|
|
141
|
+
expect(screen.getByTestId('label-test-id').outerHTML).toMatchSnapshot();
|
|
142
|
+
});
|
|
84
143
|
});
|